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

Implement thermo_water_update scheme (non-portable wrapper to cam_thermo_water_update) #178

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
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 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 @@ -37,6 +37,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
Loading