Skip to content

Commit

Permalink
FV3 changes for refactored ozone physics scheme (NOAA-EMC#661)
Browse files Browse the repository at this point in the history
* FV3 changes for refactored ozone physics scheme

* Remove change to metadata (Not relevant for PR)

* Split ozone physics into time_vary and run components

* Renamed file. Update SDFs

* Update ccpp-framework hash
  • Loading branch information
dustinswales committed Nov 2, 2023
1 parent 1250b41 commit 29a9e83
Show file tree
Hide file tree
Showing 40 changed files with 158 additions and 109 deletions.
12 changes: 7 additions & 5 deletions ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
'physics/physics/radsw_param.f',
'physics/physics/radlw_param.f',
'physics/physics/h2o_def.f',
'physics/physics/ozne_def.f',
'physics/physics/radiation_surface.f',
'physics/physics/module_ozphys.F90',
'data/CCPP_typedefs.F90',
'data/GFS_typedefs.F90',
'data/CCPP_data.F90',
Expand All @@ -41,6 +41,10 @@
'module_radlw_parameters' : {
'module_radlw_parameters' : '',
},
'module_ozphys' : {
'module_ozphys' : '',
'ty_ozphys' : '',
},
'CCPP_typedefs' : {
'GFS_interstitial_type' : 'GFS_Interstitial(cdata%thrd_no)',
'GFDL_interstitial_type' : 'GFDL_interstitial',
Expand Down Expand Up @@ -105,6 +109,7 @@
'physics/physics/GFS_surface_loop_control_part1.F90',
'physics/physics/GFS_surface_loop_control_part2.F90',
'physics/physics/GFS_time_vary_pre.fv3.F90',
'physics/physics/GFS_physics_post.F90',
'physics/physics/cires_ugwp.F90',
'physics/physics/cires_ugwp_post.F90',
'physics/physics/unified_ugwp.F90',
Expand Down Expand Up @@ -162,11 +167,8 @@
'physics/physics/mp_thompson_pre.F90',
'physics/physics/mp_thompson.F90',
'physics/physics/mp_thompson_post.F90',
'physics/physics/mp_nssl.F90' ,
'physics/physics/ozphys.f',
'physics/physics/ozphys_2015.f',
'physics/physics/mp_nssl.F90',
'physics/physics/zhaocarr_precpd.f',
'physics/physics/phys_tend.F90',
'physics/physics/radlw_main.F90',
'physics/physics/radsw_main.F90',
'physics/physics/rascnv.F90',
Expand Down
3 changes: 1 addition & 2 deletions ccpp/data/CCPP_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module CCPP_typedefs
use machine, only: kind_grid, kind_dyn, kind_phys

! Constants/dimensions needed for interstitial DDTs
use ozne_def, only: oz_coeff
use GFS_typedefs, only: clear_val, LTP

! Physics type defininitions needed for interstitial DDTs
Expand Down Expand Up @@ -881,7 +880,7 @@ subroutine gfs_interstitial_create (Interstitial, IM, Model)
Interstitial%nf_albd = NF_ALBD
Interstitial%nspc1 = NSPC1
if (Model%oz_phys .or. Model%oz_phys_2015) then
Interstitial%oz_coeffp5 = oz_coeff+5
Interstitial%oz_coeffp5 = Model%oz_coeff+5
else
Interstitial%oz_coeffp5 = 5
endif
Expand Down
2 changes: 1 addition & 1 deletion ccpp/data/CCPP_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -3187,7 +3187,7 @@
name = CCPP_typedefs
type = module
relative_path = ../physics/physics
dependencies = machine.F,ozne_def.f,radlw_param.f,radsw_param.f
dependencies = machine.F,radlw_param.f,radsw_param.f
dependencies = rte-rrtmgp/rrtmgp/mo_gas_optics_rrtmgp.F90,rte-rrtmgp/rte/mo_optical_props.F90
dependencies = rte-rrtmgp/extensions/cloud_optics/mo_cloud_optics.F90
dependencies = rte-rrtmgp/rrtmgp/mo_gas_concentrations.F90,rte-rrtmgp/rte/mo_rte_config.F90
Expand Down
86 changes: 55 additions & 31 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ module GFS_typedefs
con_csol, con_epsqs, con_rocp, con_rog, &
con_omega, con_rerth, con_psat, karman, rainmin,&
con_c, con_plnk, con_boltz, con_solr_2008, &
con_solr_2002, con_thgni
con_solr_2002, con_thgni, con_1ovg

use module_radsw_parameters, only: topfsw_type, sfcfsw_type
use module_radlw_parameters, only: topflw_type, sfcflw_type
use ozne_def, only: levozp, oz_coeff
use h2o_def, only: levh2o, h2o_coeff
use module_ozphys, only: ty_ozphys

implicit none

Expand Down Expand Up @@ -1113,8 +1113,6 @@ module GFS_typedefs
logical :: shocaftcnv !< flag for SHOC
logical :: shoc_cld !< flag for clouds
logical :: uni_cld !< flag for clouds in grrad
logical :: oz_phys !< flag for old (2006) ozone physics
logical :: oz_phys_2015 !< flag for new (2015) ozone physics
logical :: h2o_phys !< flag for stratosphere h2o
logical :: pdfcld !< flag for pdfcld
logical :: shcnvcw !< flag for shallow convective cloud
Expand Down Expand Up @@ -1567,6 +1565,13 @@ module GFS_typedefs
!--- lightning threat and diagsnostics
logical :: lightning_threat !< report lightning threat indices

!--- NRL Ozone physics
logical :: oz_phys !< Flag for old (2006) ozone physics
logical :: oz_phys_2015 !< Flag for new (2015) ozone physics
type(ty_ozphys) :: ozphys !< DDT with data needed by ozone physics
integer :: levozp !< Number of vertical layers in ozone forcing data
integer :: oz_coeff !< Number of coefficients in ozone forcing data

contains
procedure :: init => control_initialize
procedure :: init_chemistry => control_chemistry_initialize
Expand Down Expand Up @@ -1790,7 +1795,7 @@ module GFS_typedefs
!--- In/Out (???) (physics only)
real (kind=kind_phys), pointer :: swhc (:,:) => null() !< clear sky sw heating rates ( k/s )
real (kind=kind_phys), pointer :: lwhc (:,:) => null() !< clear sky lw heating rates ( k/s )
real (kind=kind_phys), pointer :: lwhd (:,:,:) => null() !< idea sky lw heating rates ( k/s )
real (kind=kind_phys), pointer :: lwhd (:,:,:) => null() !< idea sky lw heating rates ( k/s ) !DJS2023 THIS IS NOT USED. IT IS REFERENCED, BUT NEVER SET?

contains
procedure :: create => radtend_create !< allocate array data
Expand Down Expand Up @@ -2098,6 +2103,12 @@ module GFS_typedefs
real (kind=kind_phys), pointer :: ltg2_max(:) => null() !
real (kind=kind_phys), pointer :: ltg3_max(:) => null() !

!--- NRL Ozone physics diagnostics
real (kind=kind_phys), pointer :: do3_dt_prd(:,:) => null()
real (kind=kind_phys), pointer :: do3_dt_ozmx(:,:) => null()
real (kind=kind_phys), pointer :: do3_dt_temp(:,:) => null()
real (kind=kind_phys), pointer :: do3_dt_ohoz(:,:) => null()

contains
procedure :: create => diag_create
procedure :: rad_zero => diag_rad_zero
Expand Down Expand Up @@ -3549,8 +3560,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
logical :: do_shoc = .false. !< flag for SHOC
logical :: shocaftcnv = .false. !< flag for SHOC
logical :: shoc_cld = .false. !< flag for SHOC in grrad
logical :: oz_phys = .true. !< flag for old (2006) ozone physics
logical :: oz_phys_2015 = .false. !< flag for new (2015) ozone physics
logical :: h2o_phys = .false. !< flag for stratosphere h2o
logical :: pdfcld = .false. !< flag for pdfcld
logical :: shcnvcw = .false. !< flag for shallow convective cloud
Expand Down Expand Up @@ -3833,6 +3842,12 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
!-- Lightning threat index
logical :: lightning_threat = .false.

!--- NRL Ozone physics
logical :: oz_phys = .false. !< Flag for old (2006) ozone physics
logical :: oz_phys_2015 = .true. !< Flag for new (2015) ozone physics
integer :: kozpl = 28 !< File identifier for ozone forcing data
integer :: kozc = 48 !< File identifier for ozone climotology data

!--- aerosol scavenging factors
integer, parameter :: max_scav_factors = 183
character(len=40) :: fscav_aero(max_scav_factors)
Expand Down Expand Up @@ -4007,6 +4022,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
character(len=20) :: namestr
character(len=44) :: descstr

!--- NRL ozone physics
character(len=128) :: err_message

! dtend selection: default is to match all variables:
dtend_select(1)='*'
do ipat=2,pat_count
Expand Down Expand Up @@ -5391,29 +5409,23 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &

ENDIF !}

! To ensure that these values match what's in the physics,
! array sizes are compared during model init in GFS_phys_time_vary_init()
!
! from module ozinterp
if (Model%ntoz>0) then
if (Model%oz_phys) then
levozp = 80
oz_coeff = 4
else if (Model%oz_phys_2015) then
levozp = 53
oz_coeff = 6
else
write(*,*) 'Logic error, ntoz>0 but no ozone physics selected'
stop
end if
!--- NRL ozone physics
if (Model%ntoz > 0) then
! Load data for ozone physics into DDT ozphys
err_message = Model%ozphys%load_o3prog('global_o3prdlos.f77',kozpl)
Model%levozp = Model%ozphys%nlev
Model%oz_coeff = Model%ozphys%ncf

if (Model%me == Model%master) then
write(*,*) 'Reading in o3data from global_o3prdlos.f77 '
write(*,*) ' oz_coeff = ', Model%ozphys%ncf
write(*,*) ' latsozp = ', Model%ozphys%nlat
write(*,*) ' levozp = ', Model%ozphys%nlev
write(*,*) ' timeoz = ', Model%ozphys%ntime
endif
else
if (Model%oz_phys .or. Model%oz_phys_2015) then
write(*,*) 'Logic error, ozone physics are selected, but ntoz<=0'
stop
else
levozp = 1
oz_coeff = 1
end if
!--- Climatological ozone
err_message = Model%ozphys%load_o3clim('global_o3prdlos.f77',kozc)
end if

!--- quantities to be used to derive phy_f*d totals
Expand Down Expand Up @@ -6941,10 +6953,10 @@ subroutine tbd_create (Tbd, IM, Model)
endif

!--- ozone and stratosphere h2o needs
allocate (Tbd%ozpl (IM,levozp,oz_coeff))
allocate (Tbd%ozpl (IM,Model%levozp,Model%oz_coeff))
allocate (Tbd%h2opl (IM,levh2o,h2o_coeff))
Tbd%ozpl = clear_val
Tbd%h2opl = clear_val
Tbd%ozpl = clear_val

!--- ccn and in needs
! DH* allocate only for MG? *DH
Expand Down Expand Up @@ -7559,6 +7571,12 @@ subroutine diag_create (Diag, IM, Model)
allocate (Diag%dwn_mf (IM,Model%levs))
allocate (Diag%det_mf (IM,Model%levs))
endif
if (Model%oz_phys_2015) then
allocate(Diag%do3_dt_prd( IM, Model%levs))
allocate(Diag%do3_dt_ozmx(IM, Model%levs))
allocate(Diag%do3_dt_temp(IM, Model%levs))
allocate(Diag%do3_dt_ohoz(IM, Model%levs))
endif
endif

! UGWP
Expand Down Expand Up @@ -7897,6 +7915,12 @@ subroutine diag_phys_zero (Diag, Model, linit, iauwindow_center)
Diag%dwn_mf = zero
Diag%det_mf = zero
endif
if (Model%oz_phys_2015) then
Diag%do3_dt_prd = zero
Diag%do3_dt_ozmx = zero
Diag%do3_dt_temp = zero
Diag%do3_dt_ohoz = zero
endif
endif

!
Expand Down
61 changes: 59 additions & 2 deletions ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -5053,6 +5053,12 @@
units = flag
dimensions = ()
type = logical
[ozphys]
standard_name = dataset_for_ozone_physics
long_name = dataset for NRL ozone physics
units = mixed
dimensions = ()
type = ty_ozphys
[h2o_phys]
standard_name = flag_for_stratospheric_water_vapor_physics
long_name = flag for stratospheric water vapor physics
Expand Down Expand Up @@ -6651,6 +6657,18 @@
units = flag
dimensions = ()
type = logical
[levozp]
standard_name = vertical_dimension_of_ozone_forcing_data
long_name = number of vertical layers in ozone forcing data
units = count
dimensions = ()
type = integer
[oz_coeff]
standard_name = number_of_coefficients_in_ozone_data
long_name = number of coefficients in ozone forcing data
units = count
dimensions = ()
type = integer
[ipt]
standard_name = index_of_horizontal_gridpoint_for_debug_output
long_name = horizontal index for point used for diagnostic printout
Expand Down Expand Up @@ -7410,7 +7428,7 @@
standard_name = ozone_forcing
long_name = ozone forcing data
units = mixed
dimensions = (horizontal_loop_extent,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_forcing_data)
dimensions = (horizontal_loop_extent,vertical_dimension_of_ozone_forcing_data,number_of_coefficients_in_ozone_data)
type = real
kind = kind_phys
[h2opl]
Expand Down Expand Up @@ -8856,6 +8874,38 @@
type = real
kind = kind_phys
active = (flag_for_tracer_diagnostics_3D)
[do3_dt_prd]
standard_name = ozone_tendency_due_to_production_and_loss_rate
long_name = ozone tendency due to production and loss rate
units = kg kg-1 s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (flag_for_tracer_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme)
[do3_dt_ozmx]
standard_name = ozone_tendency_due_to_ozone_mixing_ratio
long_name = ozone tendency due to ozone mixing ratio
units = kg kg-1 s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (flag_for_tracer_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme)
[do3_dt_temp]
standard_name = ozone_tendency_due_to_temperature
long_name = ozone tendency due to temperature
units = kg kg-1 s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (flag_for_tracer_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme)
[do3_dt_ohoz]
standard_name = ozone_tendency_due_to_overhead_ozone_column
long_name = ozone tendency due to overhead ozone column
units = kg kg-1 s-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
active = (flag_for_tracer_diagnostics_3D .and. flag_for_nrl_2015_ozone_scheme)
[refl_10cm]
standard_name = radar_reflectivity_10cm
long_name = instantaneous refl_10cm
Expand Down Expand Up @@ -9616,7 +9666,7 @@
type = module
relative_path = ../physics/physics
dependencies = machine.F,physcons.F90,radlw_param.f,radsw_param.f
dependencies = GFDL_parse_tracers.F90,h2o_def.f,ozne_def.f
dependencies = GFDL_parse_tracers.F90,h2o_def.f,module_ozphys.F90

[ccpp-arg-table]
name = GFS_typedefs
Expand Down Expand Up @@ -9784,6 +9834,13 @@
dimensions = ()
type = real
kind = kind_phys
[con_1ovg]
standard_name = one_divided_by_the_gravitational_acceleration
long_name = inverse of gravitational acceleration
units = s2 m-1
dimensions = ()
type = real
kind = kind_phys
[con_hvap]
standard_name = latent_heat_of_vaporization_of_water_at_0C
long_name = latent heat of evaporation/sublimation
Expand Down
3 changes: 1 addition & 2 deletions ccpp/suites/suite_FV3_GFS_v15_thompson_mynn_lam3km.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
<scheme>cires_ugwp_post</scheme>
<scheme>GFS_GWD_generic_post</scheme>
<scheme>GFS_suite_stateout_update</scheme>
<scheme>ozphys_2015</scheme>
<scheme>h2ophys</scheme>
<scheme>get_phi_fv3</scheme>
<scheme>GFS_suite_interstitial_3</scheme>
Expand All @@ -71,7 +70,7 @@
<scheme>mp_thompson_post</scheme>
<scheme>GFS_MP_generic_post</scheme>
<scheme>maximum_hourly_diagnostics</scheme>
<scheme>phys_tend</scheme>
<scheme>GFS_physics_post</scheme>
</subcycle>
</group>
<group name="stochastics">
Expand Down
3 changes: 1 addition & 2 deletions ccpp/suites/suite_FV3_GFS_v15p2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
<scheme>cires_ugwp_post</scheme>
<scheme>GFS_GWD_generic_post</scheme>
<scheme>GFS_suite_stateout_update</scheme>
<scheme>ozphys_2015</scheme>
<scheme>h2ophys</scheme>
<scheme>get_phi_fv3</scheme>
<scheme>GFS_suite_interstitial_3</scheme>
Expand All @@ -82,7 +81,7 @@
<scheme>gfdl_cloud_microphys</scheme>
<scheme>GFS_MP_generic_post</scheme>
<scheme>maximum_hourly_diagnostics</scheme>
<scheme>phys_tend</scheme>
<scheme>GFS_physics_post</scheme>
</subcycle>
</group>
<group name="stochastics">
Expand Down
Loading

0 comments on commit 29a9e83

Please sign in to comment.