! $Id: adaptdt.f90 5195 2024-09-16 13:18:00Z abarral $ SUBROUTINE adaptdt(nadv,dtbon,n,pbaru, & masse) USE comconst_mod, ONLY: dtvr USE lmdz_comdissip, ONLY: coefdis, tetavel, tetatemp, gamdissip, niterdis USE lmdz_comgeom2 USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm USE lmdz_paramet IMPLICIT NONE !---------------------------------------------------------- ! Arguments !---------------------------------------------------------- INTEGER :: n,nadv REAL :: dtbon REAL :: pbaru(iip1,jjp1,llm) REAL :: masse(iip1,jjp1,llm) !---------------------------------------------------------- ! Local !---------------------------------------------------------- INTEGER :: i,j,l REAL :: CFLmax,aaa,bbb CFLmax=0. DO l=1,llm DO j=2,jjm DO i=1,iim aaa=pbaru(i,j,l)*dtvr/masse(i,j,l) CFLmax=max(CFLmax,aaa) bbb=-pbaru(i,j,l)*dtvr/masse(i+1,j,l) CFLmax=max(CFLmax,bbb) enddo enddo enddo n=int(CFLmax)+1 ! pour reproduire cas VL du code qui appele x,y,z,y,x ! if (nadv.EQ.30) n=n/2 ! Pour Prather dtbon=dtvr/n RETURN END SUBROUTINE adaptdt