Skip to content

Commit 8309276

Browse files
committed
Merge branch 'feature/wrapper_1183_1188_1189_ncar' of https://github.com/climbfuji/ccpp-physics into feature/wrapper_1183_1188_1189_ufs_community
2 parents 55886ae + 713ddac commit 8309276

10 files changed

Lines changed: 329 additions & 416 deletions

File tree

physics/GWD/cires_ugwp.F90

Lines changed: 44 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module cires_ugwp
3939
!! \htmlinclude cires_ugwp_init.html
4040
!!
4141
subroutine cires_ugwp_init (me, master, nlunit, input_nml_file, logunit, &
42-
fn_nml2, lonr, latr, levs, ak, bk, dtp, cdmbgwd, cgwf, &
42+
fn_nml2, lonr, levs, ak, bk, dtp, cdmbgwd, cgwf, &
4343
pa_rf_in, tau_rf_in, con_p0, gwd_opt,do_ugwp, errmsg, errflg)
4444

4545
!---- initialization of cires_ugwp
@@ -52,7 +52,6 @@ subroutine cires_ugwp_init (me, master, nlunit, input_nml_file, logunit, &
5252
integer, intent (in) :: logunit
5353
integer, intent (in) :: lonr
5454
integer, intent (in) :: levs
55-
integer, intent (in) :: latr
5655
real(kind=kind_phys), intent (in) :: ak(:), bk(:)
5756
real(kind=kind_phys), intent (in) :: dtp
5857
real(kind=kind_phys), intent (in) :: cdmbgwd(:), cgwf(:) ! "scaling" controls for "old" GFS-GW schemes
@@ -64,11 +63,6 @@ subroutine cires_ugwp_init (me, master, nlunit, input_nml_file, logunit, &
6463
character(len=*), intent (in) :: fn_nml2
6564
!character(len=*), parameter :: fn_nml='input.nml'
6665

67-
integer :: ios
68-
logical :: exists
69-
real :: dxsg
70-
integer :: k
71-
7266
character(len=*), intent(out) :: errmsg
7367
integer, intent(out) :: errflg
7468

@@ -77,19 +71,21 @@ subroutine cires_ugwp_init (me, master, nlunit, input_nml_file, logunit, &
7771
errflg = 0
7872

7973
if (is_initialized) return
80-
74+
8175
! Consistency checks
8276
if (gwd_opt/=1) then
8377
write(errmsg,'(*(a))') "Logic error: namelist choice of gravity wave &
8478
& drag is different from cires_ugwp scheme"
8579
errflg = 1
8680
return
87-
end if
81+
end if
8882

8983
if (do_ugwp .or. cdmbgwd(3) > 0.0) then
9084
call cires_ugwpv0_mod_init (me, master, nlunit, input_nml_file, logunit, &
91-
fn_nml2, lonr, latr, levs, ak, bk, con_p0, dtp, &
92-
cdmbgwd(1:2), cgwf, pa_rf_in, tau_rf_in)
85+
fn_nml2, lonr, levs, ak, bk, con_p0, dtp, &
86+
cdmbgwd(1:2), cgwf, pa_rf_in, tau_rf_in, &
87+
errmsg, errflg)
88+
if (errflg/=0) return
9389
else
9490
write(errmsg,'(*(a))') "Logic error: cires_ugwp_init called but do_ugwp is false and cdmbgwd(3) <= 0"
9591
errflg = 1
@@ -106,7 +102,6 @@ subroutine cires_ugwp_init (me, master, nlunit, input_nml_file, logunit, &
106102

107103
end subroutine cires_ugwp_init
108104

109-
110105
! -----------------------------------------------------------------------
111106
! finalize of cires_ugwp (_finalize)
112107
! -----------------------------------------------------------------------
@@ -136,7 +131,6 @@ subroutine cires_ugwp_finalize(errmsg, errflg)
136131

137132
end subroutine cires_ugwp_finalize
138133

139-
140134
! -----------------------------------------------------------------------
141135
! originally from ugwp_driver_v0.f
142136
! driver of cires_ugwp (_driver)
@@ -147,45 +141,45 @@ end subroutine cires_ugwp_finalize
147141
! -----------------------------------------------------------------------
148142
!>@brief These subroutines and modules execute the CIRES UGWP Version 0.
149143
!> \section gen_cires_ugwp CIRES UGWP V0 Scheme General Algorithm
150-
!! The physics of Non-Orographic Gravity Waves (NGWs) in the UGWP framework
151-
!!(Yudin et al. 2018 \cite yudin_et_al_2018) is represented by four GW-solvers, introduced in
152-
!!Lindzen (1981) \cite lindzen_1981, Hines (1997) \cite hines_1997, Alexander
153-
!!and Dunkerton (1999) \cite alexander_and_dunkerton_1999, and Scinocca (2003) \cite scinocca_2003.
154-
!!A major modification of these GW solvers was introduced with the addition of the
155-
!!background dissipation of temperature and winds to the saturation criteria for wave breaking.
156-
!!This feature is important in the mesosphere and thermosphere for WAM applications and it
157-
!!considers appropriate scale-dependent dissipation of waves near the model top lid providing
158-
!!the momentum and energy conservation in the vertical column physics (Shaw and
159-
!!Shepherd (2009) \cite shaw_and_shepherd_2009). In the UGWP-v0 scheme, a modification of the
160-
!!Scinocca (2003) \cite scinocca_2003 algorithm for NGWs with non-hydrostatic and rotational
161-
!!effects for GW propagations and background dissipation is contained in the subroutine
162-
!!fv3_ugwp_solv2_v0. Future development plans for the UGWP scheme include additional GW-solvers
163-
!!to be implemented along with physics-based triggering of waves and stochastic approaches
164-
!!for selection of GW modes characterized by horizontal phase velocities, azimuthal
144+
!! The physics of Non-Orographic Gravity Waves (NGWs) in the UGWP framework
145+
!!(Yudin et al. 2018 \cite yudin_et_al_2018) is represented by four GW-solvers, introduced in
146+
!!Lindzen (1981) \cite lindzen_1981, Hines (1997) \cite hines_1997, Alexander
147+
!!and Dunkerton (1999) \cite alexander_and_dunkerton_1999, and Scinocca (2003) \cite scinocca_2003.
148+
!!A major modification of these GW solvers was introduced with the addition of the
149+
!!background dissipation of temperature and winds to the saturation criteria for wave breaking.
150+
!!This feature is important in the mesosphere and thermosphere for WAM applications and it
151+
!!considers appropriate scale-dependent dissipation of waves near the model top lid providing
152+
!!the momentum and energy conservation in the vertical column physics (Shaw and
153+
!!Shepherd (2009) \cite shaw_and_shepherd_2009). In the UGWP-v0 scheme, a modification of the
154+
!!Scinocca (2003) \cite scinocca_2003 algorithm for NGWs with non-hydrostatic and rotational
155+
!!effects for GW propagations and background dissipation is contained in the subroutine
156+
!!fv3_ugwp_solv2_v0. Future development plans for the UGWP scheme include additional GW-solvers
157+
!!to be implemented along with physics-based triggering of waves and stochastic approaches
158+
!!for selection of GW modes characterized by horizontal phase velocities, azimuthal
165159
!!directions and magnitude of the vertical momentum flux (VMF).
166160
!!
167-
!! In UGWP-v0, the specification for the VMF function is adopted from the
168-
!! GEOS-5 global atmosphere model of GMAO NASA/GSFC, as described in
169-
!! Molod et al. (2015) \cite molod_et_al_2015 and employed in the MERRRA-2
170-
!! reanalysis (Gelaro et al., 2017 \cite gelaro_et_al_2017). The Fortran
171-
!! subroutine slat_geos5_tamp_v0() describes the latitudinal shape of
172-
!! VMF-function as displayed in Figure 3 of Molod et al. (2015)
173-
!! \cite molod_et_al_2015. It shows that the enhanced values of
174-
!! VMF in the equatorial region gives opportunity to simulate the
175-
!! QBO-like oscillations in the equatorial zonal winds and lead to more
176-
!! realistic simulations of the equatorial dynamics in GEOS-5 operational
177-
!! and MERRA-2 reanalysis products. For the first vertically extended
178-
!! version of FV3GFS in the stratosphere and mesosphere, this simplified
179-
!! function of VMF allows us to tune the model climate and to evaluate
180-
!! multi-year simulations of FV3GFS with the MERRA-2 and ERA-5 reanalysis
181-
!! products, along with temperature, ozone, and water vapor observations
182-
!! of current satellite missions. After delivery of the UGWP-code, the
183-
!! EMC group developed and tested approach to modulate the zonal mean
184-
!! NGW forcing by 3D-distributions of the total precipitation as a proxy
185-
!! for the excitation of NGWs by convection and the vertically-integrated
186-
!! (surface - tropopause) Turbulent Kinetic Energy (TKE). The verification
187-
!! scores with updated NGW forcing, as reported elsewhere by EMC researchers,
188-
!! display noticeable improvements in the forecast scores produced by
161+
!! In UGWP-v0, the specification for the VMF function is adopted from the
162+
!! GEOS-5 global atmosphere model of GMAO NASA/GSFC, as described in
163+
!! Molod et al. (2015) \cite molod_et_al_2015 and employed in the MERRRA-2
164+
!! reanalysis (Gelaro et al., 2017 \cite gelaro_et_al_2017). The Fortran
165+
!! subroutine slat_geos5_tamp_v0() describes the latitudinal shape of
166+
!! VMF-function as displayed in Figure 3 of Molod et al. (2015)
167+
!! \cite molod_et_al_2015. It shows that the enhanced values of
168+
!! VMF in the equatorial region gives opportunity to simulate the
169+
!! QBO-like oscillations in the equatorial zonal winds and lead to more
170+
!! realistic simulations of the equatorial dynamics in GEOS-5 operational
171+
!! and MERRA-2 reanalysis products. For the first vertically extended
172+
!! version of FV3GFS in the stratosphere and mesosphere, this simplified
173+
!! function of VMF allows us to tune the model climate and to evaluate
174+
!! multi-year simulations of FV3GFS with the MERRA-2 and ERA-5 reanalysis
175+
!! products, along with temperature, ozone, and water vapor observations
176+
!! of current satellite missions. After delivery of the UGWP-code, the
177+
!! EMC group developed and tested approach to modulate the zonal mean
178+
!! NGW forcing by 3D-distributions of the total precipitation as a proxy
179+
!! for the excitation of NGWs by convection and the vertically-integrated
180+
!! (surface - tropopause) Turbulent Kinetic Energy (TKE). The verification
181+
!! scores with updated NGW forcing, as reported elsewhere by EMC researchers,
182+
!! display noticeable improvements in the forecast scores produced by
189183
!! FV3GFS configuration extended into the mesosphere.
190184
!!
191185
!> \section arg_table_cires_ugwp_run Argument Table
@@ -335,7 +329,6 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr
335329

336330
endif ! do_ugwp
337331

338-
339332
if(ldiag3d .and. lssav .and. .not. flag_for_gwd_generic_tend) then
340333
idtend = dtidx(index_of_x_wind,index_of_process_orographic_gwd)
341334
if(idtend>=1) then
@@ -350,7 +343,6 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr
350343
dtend(:,:,idtend) = dtend(:,:,idtend) + Pdtdt*dtp
351344
endif
352345
endif
353-
354346

355347
if (cdmbgwd(3) > 0.0) then
356348

physics/GWD/cires_ugwp.meta

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,6 @@
6060
dimensions = ()
6161
type = integer
6262
intent = in
63-
[latr]
64-
standard_name = number_of_latitude_points
65-
long_name = number of global points in y-dir (j) along the meridian
66-
units = count
67-
dimensions = ()
68-
type = integer
69-
intent = in
7063
[levs]
7164
standard_name = vertical_layer_dimension
7265
long_name = number of vertical levels
@@ -822,7 +815,7 @@
822815
type = real
823816
kind = kind_phys
824817
intent = in
825-
[dqdt_tke]
818+
[dqdt_tke]
826819
standard_name = process_split_cumulative_tendency_of_turbulent_kinetic_energy
827820
long_name = turbulent kinetic energy tendency due to model physics
828821
units = J s-1

physics/GWD/cires_ugwp_module.F90

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ module cires_ugwpv0_module
1919
real, parameter :: pi2 = 2.*pi
2020
real, parameter :: hps = 7000.
2121
real, parameter :: hpskm = hps/1000.
22-
!
22+
2323
real :: kxw = 6.28e-3/100. !< single horizontal wavenumber of ugwp schemes
2424
real, parameter :: ricrit = 0.25
2525
real, parameter :: frcrit = 0.50
2626
real, parameter :: linsat = 1.00
2727
real, parameter :: linsat2 = linsat*linsat
28-
!
2928

3029
integer :: knob_ugwp_solver=1 !< 1, 2, 3, 4 - (linsat, ifs_2010, ad_gfdl, dsp_dis)
3130
integer, dimension(4) :: knob_ugwp_source !< [1,1,1,0] - (oro, fronts, conv, imbf-owp]
@@ -38,23 +37,22 @@ module cires_ugwpv0_module
3837
integer :: knob_ugwp_doheat=1 !< 1 -gwheat
3938
integer :: knob_ugwp_dokdis=0 !< 1 -gwmixing
4039
integer :: knob_ugwp_ndx4lh = 2 !< n-number of "unresolved" "n*dx" for lh_gw
41-
!
40+
4241
integer :: ugwp_azdir
4342
integer :: ugwp_stoch
4443

4544
integer :: ugwp_src
4645
integer :: ugwp_nws
4746
real :: ugwp_effac
4847

49-
!
5048
data knob_ugwp_source / 1,0, 1, 0 / !< oro-conv-fjet-okw-taub_lat: 1-active 0-off
5149
data knob_ugwp_wvspec /1,32,32,32/ !< number of waves for- (oro, fronts, conv, imbf-owp, taulat]
5250
data knob_ugwp_azdir /2, 4, 4,4/ !< number of wave azimuths for- (oro, fronts, conv, imbf-okwp]
5351
data knob_ugwp_stoch /0, 0, 0,0/ !< 0 - deterministic ; 1 - stochastic, non-activated option
5452
data knob_ugwp_effac /1.,1.,1.,1./ !< efficiency factors for- (oro, fronts, conv, imbf-owp]
5553
integer :: knob_ugwp_version = 0 !< version control had sense under IPD in CCPP=> to SUITES
5654
integer :: launch_level = 55
57-
!
55+
5856
namelist /cires_ugwp_nml/ knob_ugwp_solver, knob_ugwp_source,knob_ugwp_wvspec, knob_ugwp_azdir, &
5957
knob_ugwp_stoch, knob_ugwp_effac,knob_ugwp_doaxyz, knob_ugwp_doheat, knob_ugwp_dokdis, &
6058
knob_ugwp_ndx4lh, knob_ugwp_version, launch_level
@@ -91,7 +89,7 @@ module cires_ugwpv0_module
9189
real, parameter :: F_coriol=1 ! Coriolis effects
9290
real, parameter :: F_nonhyd=1 ! Nonhydrostatic waves
9391
real, parameter :: F_kds =0 ! Eddy mixing due to GW-unstable below
94-
real, parameter :: iPr_ktgw =1./3., iPr_spgw=iPr_ktgw
92+
real, parameter :: iPr_ktgw =1./3., iPr_spgw=iPr_ktgw
9593
real, parameter :: iPr_turb =1./3., iPr_mol =1.95
9694
real, parameter :: rhp1=1./hps, rhp2=0.5*rhp1, rhp4 = rhp2*rhp2
9795
real, parameter :: khp = 0.287*rhp1 ! R/Cp/Hp
@@ -104,15 +102,15 @@ module cires_ugwpv0_module
104102
! init of cires_ugwp (_init) called from GFS_driver.F90
105103
!
106104
! -----------------------------------------------------------------------
107-
!>This subroutine initializes CIRES UGWP
105+
!>This subroutine initializes CIRES UGWP
108106
subroutine cires_ugwpv0_mod_init (me, master, nlunit, input_nml_file, logunit, &
109-
fn_nml, lonr, latr, levs, ak, bk, pref, dtp, cdmvgwd, cgwf, &
110-
pa_rf_in, tau_rf_in)
107+
fn_nml, lonr, levs, ak, bk, pref, dtp, cdmvgwd, cgwf, &
108+
pa_rf_in, tau_rf_in, errmsg, errflg)
111109

112110
use ugwpv0_oro_init, only : init_oro_gws_v0
113111
use ugwpv0_wmsdis_init, only : initsolv_wmsdis_v0, ilaunch
114112
use ugwpv0_lsatdis_init, only : initsolv_lsatdis_v0
115-
113+
116114
implicit none
117115

118116
integer, intent (in) :: me
@@ -123,13 +121,16 @@ subroutine cires_ugwpv0_mod_init (me, master, nlunit, input_nml_file, logunit, &
123121
character(len=64), intent (in) :: fn_nml
124122
integer, intent (in) :: lonr
125123
integer, intent (in) :: levs
126-
integer, intent (in) :: latr
127124
real, intent (in) :: ak(levs+1), bk(levs+1), pref
128125
real, intent (in) :: dtp
129126
real, intent (in) :: cdmvgwd(2), cgwf(2) ! "scaling" controls for "old" GFS-GW schemes
130127
real, intent (in) :: pa_rf_in, tau_rf_in
131128

129+
character(len=*), intent(inout) :: errmsg
130+
integer, intent(inout) :: errflg
131+
132132
integer :: ios
133+
character(len=256) :: msg
133134
logical :: exists
134135
real :: dxsg
135136
integer :: k
@@ -138,21 +139,26 @@ subroutine cires_ugwpv0_mod_init (me, master, nlunit, input_nml_file, logunit, &
138139
read (input_nml_file, nml = cires_ugwp_nml)
139140
#else
140141
if (me == master) print *, trim (fn_nml), ' GW-namelist file '
141-
142+
142143
inquire (file =trim (fn_nml) , exist = exists)
143144

144145
if (.not. exists) then
145-
if (me == master) &
146-
write (6, *) 'separate ugwp :: namelist file: ', trim (fn_nml), ' does not exist'
146+
write(errmsg,*) 'separate ugwp :: namelist file: ', trim (fn_nml), ' does not exist'
147+
errflg = 1
148+
return
147149
else
148-
open (unit = nlunit, file = trim(fn_nml), action = 'read', status = 'old', iostat = ios)
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
149156
endif
150157
rewind (nlunit)
151158
read (nlunit, nml = cires_ugwp_nml)
152159
close (nlunit)
153160
#endif
154-
155-
!
161+
156162
ilaunch = launch_level
157163
pa_rf = pa_rf_in
158164
tau_rf = tau_rf_in
@@ -167,9 +173,9 @@ subroutine cires_ugwpv0_mod_init (me, master, nlunit, input_nml_file, logunit, &
167173
! effective kxw - resolution-aware
168174
!
169175
dxsg = pi2*arad/float(lonr) * knob_ugwp_ndx4lh
170-
!
176+
171177
allocate( kvg(levs+1), ktg(levs+1) )
172-
allocate( krad(levs+1), kion(levs+1) )
178+
allocate( krad(levs+1), kion(levs+1) )
173179
allocate( zkm(levs), pmb(levs) )
174180
allocate( rfdis(levs), rfdist(levs) )
175181
!
@@ -187,8 +193,8 @@ subroutine cires_ugwpv0_mod_init (me, master, nlunit, input_nml_file, logunit, &
187193
!
188194
! Part-2 :init_SOURCES_gws -- only orowaves, but ugwp-v0 is based on gwdps.f of EMC
189195
!
190-
191-
!
196+
197+
!
192198
! call init-solver for "stationary" multi-wave spectra and sub-grid oro
193199
!
194200
call init_oro_gws_v0( knob_ugwp_wvspec(1), knob_ugwp_azdir(1), &
@@ -205,22 +211,21 @@ subroutine cires_ugwpv0_mod_init (me, master, nlunit, input_nml_file, logunit, &
205211
! call init-solvers for "broad" non-stationary multi-wave spectra
206212
!
207213
if (knob_ugwp_solver==1) then
208-
!
214+
209215
call initsolv_lsatdis_v0(me, master, knob_ugwp_wvspec(2), knob_ugwp_azdir(2), &
210216
knob_ugwp_stoch(2), knob_ugwp_effac(2), do_physb_gwsrcs, kxw )
211217
endif
212-
if (knob_ugwp_solver==2) then
213-
214-
call initsolv_wmsdis_v0(me, master, knob_ugwp_wvspec(2), knob_ugwp_azdir(2), &
215-
knob_ugwp_stoch(2), knob_ugwp_effac(2), do_physb_gwsrcs, kxw)
216-
endif
218+
if (knob_ugwp_solver==2) then
217219

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
218223

219224
!======================
220225
module_is_initialized = .true.
221226

222227
end subroutine cires_ugwpv0_mod_init
223-
!
228+
!
224229
! -----------------------------------------------------------------------
225230
! finalize of cires_ugwp (_finalize)
226231
! -----------------------------------------------------------------------
@@ -241,6 +246,4 @@ subroutine cires_ugwpv0_mod_finalize
241246
deallocate( rfdis, rfdist)
242247

243248
end subroutine cires_ugwpv0_mod_finalize
244-
!
245-
end module cires_ugwpv0_module
246-
249+
end module cires_ugwpv0_module

0 commit comments

Comments
 (0)