Skip to content

Commit

Permalink
Implement thermo_water_update scheme (non-portable wrapper to cam_the…
Browse files Browse the repository at this point in the history
…rmo_water_update) (#178)

Originator(s): @jimmielin

Summary (include the keyword ['closes', 'fixes', 'resolves'] and issue
number):

Closes #177, implementing thermo_water_update scheme to call
cam_thermo_water_update.

Describe any changes made to the namelist: N/A

List all files eliminated and why: N/A

List all files added and what they do:

Implement thermo_water_update scheme
A       schemes/thermo_water_update/thermo_water_update.F90
A       schemes/thermo_water_update/thermo_water_update.meta

List all existing files that have been modified, and describe the
changes:
(Helpful git command: `git diff --name-status
development...<your_branch_name>`)

Include thermo_water_update scheme in CAM7 suite and simple physics
suites
M       suites/suite_cam7.xml
M       suites/suite_kessler.xml
M       suites/suite_tj2016.xml

List any test failures:

Is this a science-changing update? New physics package, algorithm
change, tuning changes, etc? Yes

---------

Co-authored-by: Jesse Nusbaumer <[email protected]>
  • Loading branch information
2 people authored and mattldawson committed Feb 20, 2025
1 parent 61ca4eb commit c61b5a3
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 0 deletions.
50 changes: 50 additions & 0 deletions schemes/thermo_water_update/thermo_water_update.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
! This is a non-portable wrapper subroutine for cam_thermo_water_update
! in the cam_thermo module.
module thermo_water_update
use ccpp_kinds, only: kind_phys

implicit none
private

public :: thermo_water_update_run

contains

! Update water dependent properties
!> \section arg_table_thermo_water_update_run Argument Table
!! \htmlinclude arg_table_thermo_water_update_run.html
subroutine thermo_water_update_run( &
mmr, &
ncol, pver, &
energy_formula_dycore, &
pdel, pdeldry, &
cp_or_cv_dycore)

! This scheme is non-portable due to dependencies on cam_thermo
! for the actual logic of cam_thermo_water_update, which depends on air_composition
! and a series of other subroutines/module properties
use cam_thermo, only: cam_thermo_water_update

! Input arguments
real(kind_phys), intent(in) :: mmr(:,:,:) ! constituent mass mixing ratios [kg kg-1]
integer, intent(in) :: ncol ! number of atmospheric columns
integer, intent(in) :: pver ! number of vertical layers
integer, intent(in) :: energy_formula_dycore ! total energy formulation used by dycore
real(kind_phys), intent(in) :: pdel(:,:) ! layer thickness [Pa]
real(kind_phys), intent(in) :: pdeldry(:,:) ! dry layer thickness [Pa]

! Output arguments
real(kind_phys), intent(out) :: cp_or_cv_dycore(:,:) ! enthalpy or heat capacity, dycore dependent [J K-1 kg-1]

call cam_thermo_water_update( &
mmr = mmr, & ! mmr*factor is a dry mixing ratio
ncol = ncol, &
pver = pver, &
energy_formula = energy_formula_dycore, &
cp_or_cv_dycore = cp_or_cv_dycore(:ncol,:), &
to_dry_factor = pdel(:ncol,:)/pdeldry(:ncol,:) & ! factor to convert to dry
)

end subroutine thermo_water_update_run

end module thermo_water_update
50 changes: 50 additions & 0 deletions schemes/thermo_water_update/thermo_water_update.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[ccpp-table-properties]
name = thermo_water_update
type = scheme
dependencies = ../../../../data/cam_thermo.F90

[ccpp-arg-table]
name = thermo_water_update_run
type = scheme
[ mmr ]
standard_name = ccpp_constituents
units = none
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_layer_dimension, number_of_ccpp_constituents)
intent = in
[ ncol ]
standard_name = horizontal_loop_extent
units = count
type = integer
dimensions = ()
intent = in
[ pver ]
standard_name = vertical_layer_dimension
units = count
type = integer
dimensions = ()
intent = in
[ energy_formula_dycore ]
standard_name = total_energy_formula_for_dycore
units = 1
type = integer
dimensions = ()
intent = in
[ pdel ]
standard_name = air_pressure_thickness
units = Pa
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_layer_dimension)
intent = in
[ pdeldry ]
standard_name = air_pressure_thickness_of_dry_air
units = Pa
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_layer_dimension)
intent = in
[ cp_or_cv_dycore ]
standard_name = specific_heat_of_air_used_in_dycore
units = J kg-1 K-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_layer_dimension)
intent = out
3 changes: 3 additions & 0 deletions suites/suite_cam7.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
<!-- Save current total energy from dycore for energy fixer in time step. Total energy in current state is updated by the last check_energy_chng call. -->
<scheme>check_energy_save_teout</scheme>

<!-- Update cp/cv for energy computation based in updated water variables -->
<scheme>thermo_water_update</scheme>

<!-- MPAS and SE specific scaling of temperature for enforcing energy consistency:
First, calculate the scaling based off cp_or_cv_dycore (from cam_thermo_water_update)
Then, perform the temperature and temperature tendency scaling -->
Expand Down
4 changes: 4 additions & 0 deletions suites/suite_kessler.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<scheme>kessler_diagnostics</scheme>
</group>
<group name="physics_after_coupler">

<!-- Update cp/cv for energy computation based in updated water variables -->
<scheme>thermo_water_update</scheme>

<!-- <scheme>physics_dme_adjust</scheme> -->

<!-- MPAS and SE specific scaling of temperature for enforcing energy consistency:
Expand Down
3 changes: 3 additions & 0 deletions suites/suite_tj2016.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<scheme>apply_tendency_of_northward_wind</scheme>
<scheme>qneg</scheme>

<!-- Update cp/cv for energy computation based in updated water variables -->
<scheme>thermo_water_update</scheme>

<!-- <scheme>physics_dme_adjust</scheme> -->

<!-- MPAS and SE specific scaling of temperature for enforcing energy consistency:
Expand Down

0 comments on commit c61b5a3

Please sign in to comment.