Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor NRL h2o photochemical physics scheme #213

Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ physics/SFC_Models/SeaIce/CICE/sfc_cice.* @wd
physics/SFC_Models/SeaIce/CICE/sfc_sice.* @wd20xw @grantfirl @Qingfu-Liu @dustinswales
physics/hooks/machine.* @grantfirl @Qingfu-Liu @dustinswales
physics/hooks/physcons.F90 @grantfirl @Qingfu-Liu @dustinswales
physics/photochem/h2o_def.* @grantfirl @Qingfu-Liu @dustinswales
physics/photochem/h2ointerp.f90 @grantfirl @Qingfu-Liu @dustinswales
physics/photochem/h2ophys.* @Qingfu-Liu @grantfirl @Qingfu-Liu @dustinswales
physics/photochem/module_h2ophys.* @Qingfu-Liu @grantfirl @Qingfu-Liu @dustinswales
physics/photochem/module_ozphys.* @dustinswales @grantfirl @Qingfu-Liu @dustinswales
physics/smoke_dust/* @haiqinli @grantfirl @Qingfu-Liu @dustinswales
physics/tools/funcphys.f90 @grantfirl @Qingfu-Liu @dustinswales
Expand Down
110 changes: 110 additions & 0 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_photochemistry.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
! #########################################################################################
!> \file GFS_photochemistry.f90
!!
! #########################################################################################
module GFS_photochemistry
use machine, only: kind_phys
use module_ozphys, only: ty_ozphys
use module_h2ophys, only: ty_h2ophys
implicit none
contains

! #########################################################################################
!> \section arg_table_GFS_photochemistry_init Argument Table
!! \htmlinclude GFS_photochemistry_init.html
!!
! #########################################################################################
subroutine GFS_photochemistry_init(oz_phys_2006, oz_phys_2015, h2o_phys, errmsg, errflg)
logical, intent(in) :: &
oz_phys_2015, & ! Do ozone photochemistry? (2015)
oz_phys_2006, & ! Do ozone photochemistry? (2006)
h2o_phys ! Do stratospheric h2o photochemistry?
character(len=*), intent(out) :: &
errmsg ! CCPP Error message.
integer, intent(out) :: &
errflg ! CCPP Error flag.

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

! If no photchemical scheme is on, but SDF has this module, report an error?
if ((.not. oz_phys_2006) .and. (.not. oz_phys_2015) .and. (.not. h2o_phys)) then
dustinswales marked this conversation as resolved.
Show resolved Hide resolved
write (errmsg,'(*(a))') 'Logic error: One of [oz_phys_2006, oz_phys_2015, or h2o_phys] must == .true. '
errflg = 1
return
endif

! Only one ozone scheme can be on. Otherwise, return and report error.
if (oz_phys_2006 .and. oz_phys_2015) then
write (errmsg,'(*(a))') 'Logic error: Only one ozone scheme can be enabled at a time'
errflg = 1
return
endif

end subroutine GFS_photochemistry_init

! #########################################################################################
!> \section arg_table_GFS_photochemistry_run Argument Table
!! \htmlinclude GFS_photochemistry_run.html
!!
! #########################################################################################
subroutine GFS_photochemistry_run (dtp, ozphys, oz_phys_2015, oz_phys_2006, con_1ovg, &
prsl, dp, ozpl, h2o_phys, h2ophys, h2opl, h2o0, oz0, gt0, do3_dt_prd, do3_dt_ozmx, &
do3_dt_temp, do3_dt_ohoz, errmsg, errflg)

! Inputs
real(kind=kind_phys), intent(in) :: &
dtp, & ! Model timestep
con_1ovg ! Physical constant (1./gravity)
real(kind=kind_phys), intent(in), dimension(:,:) :: &
prsl, & ! Air pressure (Pa)
dp, & ! Pressure thickness (Pa)
gt0 ! Air temperature (K)
real(kind=kind_phys), intent(in), dimension(:,:,:) :: &
ozpl, & ! Ozone data for current model timestep.
h2opl ! h2o data for curent model timestep.
logical, intent(in) :: &
oz_phys_2015, & ! Do ozone photochemistry? (2015)
oz_phys_2006, & ! Do ozone photochemistry? (2006)
h2o_phys ! Do stratospheric h2o photochemistry?
type(ty_ozphys), intent(in) :: &
dustinswales marked this conversation as resolved.
Show resolved Hide resolved
ozphys ! DDT with ozone photochemistry scheme/data.
type(ty_h2ophys), intent(in) :: &
h2ophys ! DDT with h2o photochemistry scheme/data.

! Outputs (optional)
real(kind=kind_phys), intent(inout), dimension(:,:), optional :: &
do3_dt_prd, & ! Physics tendency: production and loss effect
do3_dt_ozmx, & ! Physics tendency: ozone mixing ratio effect
do3_dt_temp, & ! Physics tendency: temperature effect
do3_dt_ohoz ! Physics tendency: overhead ozone effect

! Outputs
real(kind=kind_phys), intent(inout), dimension(:,:) :: &
oz0, & ! Update ozone concentration.
h2o0 ! Updated h2o concentration.
character(len=*), intent(out) :: &
errmsg ! CCPP Error message.
integer, intent(out) :: &
errflg ! CCPP Error flag.

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

if (oz_phys_2015) then
call ozphys%run_o3prog_2015(con_1ovg, dtp, prsl, gt0, dp, ozpl, oz0, do3_dt_prd, &
do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz)
endif
if (oz_phys_2006) then
call ozphys%run_o3prog_2006(con_1ovg, dtp, prsl, gt0, dp, ozpl, oz0, do3_dt_prd, &
do3_dt_ozmx, do3_dt_temp, do3_dt_ohoz)
endif
if (h2o_phys) then
call h2ophys%run(dtp, prsl, h2opl, h2o0)
endif

end subroutine GFS_photochemistry_run

end module GFS_photochemistry
211 changes: 211 additions & 0 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_photochemistry.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
########################################################################
[ccpp-table-properties]
name = GFS_photochemistry
type = scheme
dependencies = ../../hooks/machine.F,../../photochem/module_ozphys.F90
dependencies = ../../photochem/module_h2ophys.F90

########################################################################
[ccpp-arg-table]
name = GFS_photochemistry_init
type = scheme
[oz_phys_2006]
standard_name = flag_for_nrl_2006_ozone_scheme
long_name = flag for new (2006) ozone physics
units = flag
dimensions = ()
type = logical
intent = in
[oz_phys_2015]
standard_name = flag_for_nrl_2015_ozone_scheme
long_name = flag for new (2015) ozone physics
units = flag
dimensions = ()
type = logical
intent = in
[h2o_phys]
standard_name = flag_for_stratospheric_water_vapor_physics
long_name = flag for stratospheric water vapor physics
units = flag
dimensions = ()
type = logical
intent = in
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
units = none
dimensions = ()
type = character
kind = len=*
intent = out
[errflg]
standard_name = ccpp_error_code
long_name = error code for error handling in CCPP
units = 1
dimensions = ()
type = integer
intent = out

########################################################################
[ccpp-arg-table]
name = GFS_photochemistry_run
type = scheme
[dtp]
standard_name = timestep_for_physics
long_name = physics timestep
units = s
dimensions = ()
type = real
kind = kind_phys
intent = in
[ozphys]
standard_name = dataset_for_ozone_physics
long_name = dataset for NRL ozone physics
units = mixed
dimensions = ()
type = ty_ozphys
intent = in
[oz_phys_2015]
standard_name = flag_for_nrl_2015_ozone_scheme
long_name = flag for new (2015) ozone physics
units = flag
dimensions = ()
type = logical
intent = in
[oz_phys_2006]
standard_name = flag_for_nrl_2006_ozone_scheme
long_name = flag for new (2006) ozone physics
units = flag
dimensions = ()
type = logical
intent = in
[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
intent = in
[prsl]
standard_name = air_pressure
long_name = mid-layer pressure
units = Pa
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = in
[dp]
standard_name = air_pressure_difference_between_midlayers
long_name = difference between mid-layer pressures
units = Pa
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = in
[ozpl]
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_data)
type = real
kind = kind_phys
intent = in
[h2o_phys]
standard_name = flag_for_stratospheric_water_vapor_physics
long_name = flag for stratospheric water vapor physics
units = flag
dimensions = ()
type = logical
intent = in
[h2ophys]
standard_name = dataset_for_h2o_photochemistry_physics
long_name = dataset for NRL h2o photochemistry physics
units = mixed
dimensions = ()
type = ty_h2ophys
intent = in
[h2opl]
standard_name = stratospheric_water_vapor_forcing
long_name = water forcing data
units = mixed
dimensions = (horizontal_loop_extent,vertical_dimension_of_h2o_forcing_data,number_of_coefficients_in_h2o_forcing_data)
type = real
kind = kind_phys
intent = in
[h2o0]
standard_name = specific_humidity_of_new_state
long_name = water vapor specific humidity updated by physics
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[oz0]
standard_name = ozone_concentration_of_new_state
long_name = ozone concentration updated by physics
units = kg kg-1
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = inout
[gt0]
standard_name = air_temperature_of_new_state
long_name = temperature updated by physics
units = K
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
type = real
kind = kind_phys
intent = in
[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
intent = inout
optional = True
[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
intent = inout
optional = True
[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
intent = inout
optional = True
[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
intent = inout
optional = True
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
units = none
dimensions = ()
type = character
kind = len=*
intent = out
[errflg]
standard_name = ccpp_error_code
long_name = error code for error handling in CCPP
units = 1
dimensions = ()
type = integer
intent = out

Loading
Loading