CCPP SciDoc v7.0.x  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
cires_ugwp_module.F90
1
3
6
7!
8! driver is called after pbl & before chem-parameterizations
9!
10
11 implicit none
12 logical :: module_is_initialized
13
14 logical :: do_physb_gwsrcs = .false.
15 logical :: do_rfdamp = .false.
16
17 real, parameter :: arad=6370.e3
18 real, parameter :: pi = atan(1.0)
19 real, parameter :: pi2 = 2.*pi
20 real, parameter :: hps = 7000.
21 real, parameter :: hpskm = hps/1000.
22
23 real :: kxw = 6.28e-3/100.
24 real, parameter :: ricrit = 0.25
25 real, parameter :: frcrit = 0.50
26 real, parameter :: linsat = 1.00
27 real, parameter :: linsat2 = linsat*linsat
28
29 integer :: knob_ugwp_solver=1
30 integer, dimension(4) :: knob_ugwp_source
31 integer, dimension(4) :: knob_ugwp_wvspec
32 integer, dimension(4) :: knob_ugwp_azdir
33 integer, dimension(4) :: knob_ugwp_stoch
34 real, dimension(4) :: knob_ugwp_effac
35
36 integer :: knob_ugwp_doaxyz=1
37 integer :: knob_ugwp_doheat=1
38 integer :: knob_ugwp_dokdis=0
39 integer :: knob_ugwp_ndx4lh = 2
40
41 integer :: ugwp_azdir
42 integer :: ugwp_stoch
43
44 integer :: ugwp_src
45 integer :: ugwp_nws
46 real :: ugwp_effac
47
48 data knob_ugwp_source / 1,0, 1, 0 /
49 data knob_ugwp_wvspec /1,32,32,32/
50 data knob_ugwp_azdir /2, 4, 4,4/
51 data knob_ugwp_stoch /0, 0, 0,0/
52 data knob_ugwp_effac /1.,1.,1.,1./
53 integer :: knob_ugwp_version = 0
54 integer :: launch_level = 55
55
56 namelist /cires_ugwp_nml/ knob_ugwp_solver, knob_ugwp_source,knob_ugwp_wvspec, knob_ugwp_azdir, &
57 knob_ugwp_stoch, knob_ugwp_effac,knob_ugwp_doaxyz, knob_ugwp_doheat, knob_ugwp_dokdis, &
58 knob_ugwp_ndx4lh, knob_ugwp_version, launch_level
59
60!&cires_ugwp_nml
61! knob_ugwp_solver=2
62! knob_ugwp_source=1,1,1,0
63! knob_ugwp_wvspec=1,32,32,32
64! knob_ugwp_azdir =2, 4, 4,4
65! knob_ugwp_stoch =0, 0, 0,0
66! knob_ugwp_effac=1, 1, 1,1
67! knob_ugwp_doaxyz=1
68! knob_ugwp_doheat=1
69! knob_ugwp_dokdis=0
70! knob_ugwp_ndx4lh=4
71!/
72!
73! allocatable arrays, initilized during "cires_ugwp_init" &
74! released during "cires_ugwp_finalize"
75!
76 real, allocatable :: kvg(:), ktg(:), krad(:), kion(:)
77 real, allocatable :: zkm(:), pmb(:)
78 real, allocatable :: rfdis(:), rfdist(:)
79 integer :: levs_rf
80 real :: pa_rf, tau_rf
81!
82! limiters
83!
84 real, parameter :: max_kdis = 400. ! 400 m2/s
85 real, parameter :: max_axyz = 400.e-5 ! 400 m/s/day
86 real, parameter :: max_eps = max_kdis*4.e-7 ! ~16 K/day
87!
88!======================================================================
89 real, parameter :: f_coriol=1 ! Coriolis effects
90 real, parameter :: f_nonhyd=1 ! Nonhydrostatic waves
91 real, parameter :: f_kds =0 ! Eddy mixing due to GW-unstable below
92 real, parameter :: ipr_ktgw =1./3., ipr_spgw=ipr_ktgw
93 real, parameter :: ipr_turb =1./3., ipr_mol =1.95
94 real, parameter :: rhp1=1./hps, rhp2=0.5*rhp1, rhp4 = rhp2*rhp2
95 real, parameter :: khp = 0.287*rhp1 ! R/Cp/Hp
96 real, parameter :: cd_ulim = 1.0 ! critical level precision or Lz ~ 0 ~dz of model
97
98 contains
99!
100! -----------------------------------------------------------------------
101!
102! init of cires_ugwp (_init) called from GFS_driver.F90
103!
104! -----------------------------------------------------------------------
106 subroutine cires_ugwpv0_mod_init (me, master, nlunit, input_nml_file, logunit, &
107 fn_nml, lonr, levs, ak, bk, pref, dtp, cdmvgwd, cgwf, &
108 pa_rf_in, tau_rf_in, errmsg, errflg)
109
110 use ugwpv0_oro_init, only : init_oro_gws_v0
111 use ugwpv0_wmsdis_init, only : initsolv_wmsdis_v0, ilaunch
112 use ugwpv0_lsatdis_init, only : initsolv_lsatdis_v0
113
114 implicit none
115
116 integer, intent (in) :: me
117 integer, intent (in) :: master
118 integer, intent (in) :: nlunit
119 character (len = *), intent (in) :: input_nml_file(:)
120 integer, intent (in) :: logunit
121 character(len=64), intent (in) :: fn_nml
122 integer, intent (in) :: lonr
123 integer, intent (in) :: levs
124 real, intent (in) :: ak(levs+1), bk(levs+1), pref
125 real, intent (in) :: dtp
126 real, intent (in) :: cdmvgwd(2), cgwf(2) ! "scaling" controls for "old" GFS-GW schemes
127 real, intent (in) :: pa_rf_in, tau_rf_in
128
129 character(len=*), intent(inout) :: errmsg
130 integer, intent(inout) :: errflg
131
132 integer :: ios
133 character(len=256) :: msg
134 logical :: exists
135 real :: dxsg
136 integer :: k
137
138#ifdef INTERNAL_FILE_NML
139 read (input_nml_file, nml = cires_ugwp_nml)
140#else
141 if (me == master) print *, trim(fn_nml), ' GW-namelist file '
142
143 inquire (file =trim(fn_nml) , exist = exists)
144
145 if (.not. exists) then
146 write(errmsg,*) 'separate ugwp :: namelist file: ', trim(fn_nml), ' does not exist'
147 errflg = 1
148 return
149 else
150 open (unit = nlunit, file = trim(fn_nml), action = 'read', status = 'old', iostat = ios, iomsg = msg)
151 if (ios /= 0) then
152 write(errmsg,*) 'ERROR: cannot open namelist file ', trim(fn_nml), ' iostat=', ios, ' msg="' // trim(msg) // '"'
153 errflg = 1
154 return
155 endif
156 endif
157 rewind(nlunit)
158 read (nlunit, nml = cires_ugwp_nml)
159 close (nlunit)
160#endif
161
162 ilaunch = launch_level
163 pa_rf = pa_rf_in
164 tau_rf = tau_rf_in
165
166! write version number and namelist to log file
167 if (me == master) then
168 write (logunit, *) " ================================================================== "
169 write (logunit, *) "cires_ugwp_cires"
170 write (logunit, nml = cires_ugwp_nml)
171 endif
172!
173! effective kxw - resolution-aware
174!
175 dxsg = pi2*arad/float(lonr) * knob_ugwp_ndx4lh
176
177 allocate( kvg(levs+1), ktg(levs+1) )
178 allocate( krad(levs+1), kion(levs+1) )
179 allocate( zkm(levs), pmb(levs) )
180 allocate( rfdis(levs), rfdist(levs) )
181!
182! ak -pa bk-dimensionless from surf => tol_lid_pressure =0
183!
184 do k=1, levs
185 pmb(k) = 1.e0*(ak(k) + pref*bk(k)) ! Pa -unit Pref = 1.e5
186 zkm(k) = -hpskm*alog(pmb(k)/pref)
187 enddo
188!
189! Part-1 :init_global_gwdis
190!
191 call init_global_gwdis_v0(levs, zkm, pmb, kvg, ktg, krad, kion)
192
193!
194! Part-2 :init_SOURCES_gws -- only orowaves, but ugwp-v0 is based on gwdps.f of EMC
195!
196
197!
198! call init-solver for "stationary" multi-wave spectra and sub-grid oro
199!
200 call init_oro_gws_v0( knob_ugwp_wvspec(1), knob_ugwp_azdir(1), &
201 knob_ugwp_stoch(1), knob_ugwp_effac(1), lonr, kxw, cdmvgwd )
202!
203! call init-sources for "non-sationary" multi-wave spectra
204!
205 do_physb_gwsrcs=.true.
206
207!======================
208! Part-3 :init_SOLVERS
209! =====================
210!
211! call init-solvers for "broad" non-stationary multi-wave spectra
212!
213 if (knob_ugwp_solver==1) then
214
215 call initsolv_lsatdis_v0(me, master, knob_ugwp_wvspec(2), knob_ugwp_azdir(2), &
216 knob_ugwp_stoch(2), knob_ugwp_effac(2), do_physb_gwsrcs, kxw )
217 endif
218 if (knob_ugwp_solver==2) then
219
220 call initsolv_wmsdis_v0(me, master, knob_ugwp_wvspec(2), knob_ugwp_azdir(2), &
221 knob_ugwp_stoch(2), knob_ugwp_effac(2), do_physb_gwsrcs, kxw)
222 endif
223
224!======================
225 module_is_initialized = .true.
226
227 end subroutine cires_ugwpv0_mod_init
228!
229! -----------------------------------------------------------------------
230! finalize of cires_ugwp (_finalize)
231! -----------------------------------------------------------------------
232
234 subroutine cires_ugwpv0_mod_finalize
235!
236! deallocate sources/spectra & some diagnostics need to find where "deaalocate them"
237! before "end" of the FV3GFS
238!
239 implicit none
240!
241! deallocate arrays employed in V0
242!
243 deallocate( kvg, ktg )
244 deallocate( krad, kion )
245 deallocate( zkm, pmb )
246 deallocate( rfdis, rfdist)
247
248 end subroutine cires_ugwpv0_mod_finalize
249end module cires_ugwpv0_module
This module contains the UGWPv0 driver.
This module contains initialization of wave solvers for UGWP v0.
This module contains orographic wave source schemes for UGWP v0.
This module contains init-solvers for "broad" non-stationary multi-wave spectra.