source: LMDZ6/trunk/libf/phylmd/lmdz_atke_turbulence_ini.f90 @ 5452

Last change on this file since 5452 was 5268, checked in by abarral, 2 months ago

.f90 <-> .F90 depending on cpp key use

File size: 8.5 KB
RevLine 
[4687]1MODULE lmdz_atke_turbulence_ini
[4449]2
3implicit none
4
[4745]5! declaration of constants and parameters
[4449]6
[4804]7real, save, protected  :: rg, rd, rpi, rcpd, rv, viscom, viscoh       
8!$OMP THREADPRIVATE(rg, rd, rpi, rcpd, rv, viscom, viscoh)     
[4478]9
[4804]10integer, save, protected :: iflag_atke        ! flag that controls options in atke_compute_km_kh
11integer, save, protected :: iflag_atke_lmix   ! flag that controls the calculation of mixing length in atke
12integer, save, protected :: iflag_num_atke    ! flag that controls the numerical treatment of diffusion coeffiient calculation
13!$OMP THREADPRIVATE(iflag_atke, iflag_atke_lmix, iflag_num_atke)
[4449]14
[4804]15logical, save, protected :: atke_ok_vdiff    ! activate vertical diffusion of TKE or not
16logical, save, protected :: atke_ok_virtual  ! account for vapor for flottability
17!$OMP THREADPRIVATE(atke_ok_vdiff, atke_ok_virtual)
[4449]18
[4804]19real, save, protected :: kappa = 0.4         ! Von Karman constant
20real, save, protected :: cn                  ! Sm value at Ri=0
21real, save, protected :: cinf                ! Sm value at Ri=-Inf
22real, save, protected :: ri0                 ! Richardson number near zero to guarantee continuity in slope of Sm (stability function) at Ri=0
23real, save, protected :: ri1                 ! Richardson number near zero to guarantee continuity in slope of Pr (Prandlt's number) at Ri=0
24real, save, protected :: lmin = 0.01         ! minimum mixing length corresponding to the Kolmogov dissipation scale  in planetary atmospheres (Chen et al 2016, JGR Atmos)
25real, save, protected :: ctkes               ! coefficient for surface TKE
26real, save, protected :: clmixshear          ! coefficient for mixing length depending on local wind shear
27!$OMP THREADPRIVATE(kappa, cn, cinf, ri0, ri1, lmin, ctkes, clmixshear)
[4449]28
29
[4804]30! Tunable parameters for the ATKE scheme and their range of values
31!!-------------------------------------------------------------------------------------------------------------
32real, save, protected :: cepsilon            ! controls the value of the dissipation length scale, range [1.2 - 10]
33real, save, protected :: cke                 ! controls the value of the diffusion coefficient of TKE, range [1 - 5]
34real, save, protected :: l0                  ! asymptotic mixing length far from the ground [m] (Sun et al 2011, JAMC), range [15 - 75]
35real, save, protected :: clmix               ! controls the value of the mixing length in stratified conditions, range [0.1 - 2]
36real, save, protected :: ric                 ! critical Richardson number controlling the slope of Sm in stable conditions, range [0.19 - 0.25]
37real, save, protected :: smmin               ! minimum value of Sm in very stable conditions (defined here as minsqrt(Ez/Ek)) at large Ri, range [0.025 - 0.1]
38real, save, protected :: pr_neut             ! neutral value of the Prandtl number (Ri=0), range [0.7 - 1]
39real, save, protected :: pr_slope            ! linear slope of Pr with Ri in the very stable regime, range [3 - 5]
40real, save, protected :: cinffac             ! ratio between cinf and cn controlling the convective limit of Sm, range [1.2 - 5.0]
41real, save, protected :: pr_asym             ! value of Prandlt in the convective limit(Ri=-Inf), range [0.3 - 0.5]
42!$OMP THREADPRIVATE(cepsilon, cke, l0, clmix, ric, smmin, pr_neut, pr_slope, cinffac, pr_asym)
43!!-------------------------------------------------------------------------------------------------------------
[4449]44
[4804]45CONTAINS
[4449]46
[4804]47SUBROUTINE atke_ini(rg_in, rd_in, rpi_in, rcpd_in, rv_in, viscom_in, viscoh_in)
48      !!----------------------------------------------------------------------
49      !!                  ***  ROUTINE  atke_ini  ***
50      !!
51      !! ** Purpose :   Initialization of the atke module and choice of some constants
[5164]52      !!                Default values correspond to the  'best' configuration
53      !!                from tuning on GABLS1 in Vignon et al. 2024, JAMES
[4804]54      !!----------------------------------------------------------------------
[4478]55
[4804]56        USE ioipsl_getin_p_mod, ONLY : getin_p                                                                                                     
[4745]57
[4804]58      ! input arguments (universal constants for planet)
59      !-------------------------------------------------
60      real, intent(in) :: rg_in, rd_in, rpi_in, rcpd_in, rv_in, viscom_in, viscoh_in
61      !!----------------------------------------------------------------------
62     
63      rg=rg_in          ! gravity acceleration
64      rd=rd_in          ! dry gas constant (R/M, R=perfect gas constant and M is the molar mass of the fluid)
65      rpi=rpi_in        ! Pi number
66      rcpd=rcpd_in      ! cp per unit mass of the gas
67      rv=rv_in          ! water vapor constant (for simulations in Earth's atmosphere)
68      viscom=viscom_in  ! kinematic molecular viscosity for momentum
69      viscoh=viscoh_in  ! kinematic molecular viscosity for heat
[4745]70
71
[4804]72      ! Read flag values in .def files
73      !-------------------------------
[4745]74
[4804]75      ! flag that controls options in atke_compute_km_kh
[5164]76      iflag_atke=1
[4804]77      CALL getin_p('iflag_atke',iflag_atke)
[4449]78
[4804]79      ! flag that controls the calculation of mixing length in atke
[5164]80      iflag_atke_lmix=3
[4804]81      CALL getin_p('iflag_atke_lmix',iflag_atke_lmix)
[4631]82
[4804]83      if (iflag_atke .eq. 0 .and. iflag_atke_lmix>0) then
84            call abort_physic("atke_turbulence_ini", &
85            'stationary scheme must use mixing length formulation not depending on tke', 1)
86      endif
[4631]87
[4804]88      ! activate vertical diffusion of TKE or not
[5164]89      atke_ok_vdiff=.true.
[4804]90      CALL getin_p('atke_ok_vdiff',atke_ok_vdiff)
[4631]91
[4804]92      ! account for vapor for flottability
93      atke_ok_virtual=.true.
94      CALL getin_p('atke_ok_virtual',atke_ok_virtual)
[4653]95
96
[4804]97      ! flag that controls the numerical treatment of diffusion coeffiient calculation
98      iflag_num_atke=0
99      CALL getin_p('iflag_num_atke',iflag_num_atke)
[4653]100
[4804]101      ! asymptotic mixing length in neutral conditions [m]
102      ! Sun et al 2011, JAMC
103      ! between 10 and 40
[5164]104      l0=42.5279652116005
[4804]105      CALL getin_p('atke_l0',l0)
[4545]106
[4804]107      ! critical Richardson number
[5164]108      ric=0.190537327781655
[4804]109      CALL getin_p('atke_ric',ric)
[4449]110
[4804]111      ! constant for tke dissipation calculation
[5164]112      cepsilon=8.89273387537601
[4804]113      CALL getin_p('atke_cepsilon',cepsilon)
[4449]114
[4804]115      ! calculation of cn = Sm value at Ri=0
116      ! direct dependance on cepsilon to guarantee Fm=1 (first-order like stability function) at Ri=0
117      cn=(1./sqrt(cepsilon))**(2/3)
[4449]118
[4804]119      ! asymptotic value of Sm for Ri=-Inf
120      cinffac=2.0
121      CALL getin_p('atke_cinffac',cinffac)
122      cinf=cinffac*cn
123      if (cinf .le. cn) then
124            call abort_physic("atke_turbulence_ini", &
125            'cinf cannot be lower than cn', 1)
126      endif
[4449]127
[4804]128      ! coefficient for surface TKE
129      ! following Lenderink & Holtslag 2004, ctkes=(cepsilon)**(2/3)
130      ! (provided by limit condition in neutral conditions)
131      ctkes=(cepsilon)**(2./3.)
[4653]132
[4804]133      ! slope of Pr=f(Ri) for stable conditions
[5164]134      pr_slope=4.67885738180385
[4804]135      CALL getin_p('atke_pr_slope',pr_slope)
136      if (pr_slope .le. 1) then
137            call abort_physic("atke_turbulence_ini", &
138            'pr_slope has to be greater than 1 for consistency of the tke scheme', 1)
139      endif
[4780]140
[4804]141      ! value of turbulent prandtl number in neutral conditions (Ri=0)
[5164]142      pr_neut=0.837372701768868
[4804]143      CALL getin_p('atke_pr_neut',pr_neut)
[4780]144
[4804]145      ! asymptotic turbulent prandt number value for Ri=-Inf
146      pr_asym=0.4
147      CALL getin_p('atke_pr_asym',pr_asym)
148      if (pr_asym .ge. pr_neut) then
149            call abort_physic("atke_turbulence_ini", &
150            'pr_asym must be be lower than pr_neut', 1)
151      endif
[4780]152
[4804]153      ! coefficient for mixing length depending on local stratification
[5164]154      clmix=0.648055235325291
[4804]155      CALL getin_p('atke_clmix',clmix)
[4653]156
[4804]157      ! coefficient for mixing length depending on local wind shear
158      clmixshear=0.5
159      CALL getin_p('atke_clmixshear',clmixshear)
[4449]160
[4804]161      ! minimum anisotropy coefficient (defined here as minsqrt(Ez/Ek)) at large Ri.
162      ! From Zilitinkevich et al. 2013, it equals sqrt(0.03)~0.17 
[5164]163      smmin=0.0960838631869678
[4804]164      CALL getin_p('atke_smmin',smmin)
[4478]165
[4804]166      ! ratio between the eddy diffusivity coeff for tke wrt that for momentum
167      ! default value from Lenderink et al. 2004
[5164]168      cke=2.47069655134662
[4804]169      CALL getin_p('atke_cke',cke)
[4780]170
[4804]171      ! calculation of Ri0 such that continuity in slope of Sm at Ri=0
172      ri0=2./rpi*(cinf - cn)*ric/cn
[4780]173
[4804]174      ! calculation of Ri1 to guarantee continuity in slope of Prandlt number at Ri=0
175      ri1 = -2./rpi * (pr_asym - pr_neut)
[4780]176
[4804]177RETURN
[4780]178
[4449]179END SUBROUTINE atke_ini
180
[4687]181END MODULE  lmdz_atke_turbulence_ini
Note: See TracBrowser for help on using the repository browser.