diff --git a/src/control/cam_comp.F90 b/src/control/cam_comp.F90
index 7667b584..27fd57a7 100644
--- a/src/control/cam_comp.F90
+++ b/src/control/cam_comp.F90
@@ -152,7 +152,7 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
dtime_phys = 0.0_r8
call mark_as_initialized('timestep_for_physics')
- is_first_timestep = is_first_step()
+ is_first_timestep = .true.
call mark_as_initialized('is_first_timestep')
call init_pio_subsystem()
diff --git a/src/data/air_composition.F90 b/src/data/air_composition.F90
index 0da0a5b2..43ce33d0 100644
--- a/src/data/air_composition.F90
+++ b/src/data/air_composition.F90
@@ -16,6 +16,7 @@ module air_composition
public :: air_composition_init
public :: dry_air_composition_update
public :: water_composition_update
+
! get_cp_dry: (generalized) heat capacity for dry air
public :: get_cp_dry
! get_cp: (generalized) heat capacity
@@ -533,7 +534,7 @@ subroutine dry_air_composition_update(mmr, ncol, to_dry_factor)
cappav(:ncol,:) = rairv(:ncol,:) / cpairv(:ncol,:)
- end subroutine air_composition_update
+ end subroutine dry_air_composition_update
!===========================================================================
!---------------------------------------------------------------------------
@@ -557,12 +558,19 @@ subroutine water_composition_update(mmr, ncol, vcoord, to_dry_factor)
! FV: moist pressure vertical coordinate does not need update.
else if (vcoord == vc_dry_pressure) then
! SE
+
+ ! TODO hplin 9/17/24: for compatibility with CAM-SIMA that allocates thermodynamic_active_species_idx(0:num_advected)
+ ! (whereas CAM only allocates 1-indexed) I subset it here. But from the meaning of the code arguments
+ ! it is unknown where it was meant to be thermodynamic_active_species_idx_dycore.
+ ! This should be verified during code review.
call get_cp(mmr(:ncol,:,:), .false., cp_or_cv_dycore(:ncol,:), &
- factor=to_dry_factor, active_species_idx_dycore=thermodynamic_active_species_idx, &
+ factor=to_dry_factor, active_species_idx_dycore=thermodynamic_active_species_idx(1:), &
cpdry=cpairv(:ncol,:))
else if (vcoord == vc_height) then
! MPAS
- call get_R(mmr(:ncol,:,:), thermodynamic_active_species_idx, &
+
+ ! TODO hplin 9/17/24 same here.
+ call get_R(mmr(:ncol,:,:), thermodynamic_active_species_idx(1:), &
cp_or_cv_dycore(:ncol,:), fact=to_dry_factor, Rdry=rairv(:ncol,:))
! internal energy coefficient for MPAS
diff --git a/src/data/cam_thermo.F90 b/src/data/cam_thermo.F90
index 2b0af969..2c7f62a5 100644
--- a/src/data/cam_thermo.F90
+++ b/src/data/cam_thermo.F90
@@ -220,7 +220,7 @@ end subroutine cam_thermo_init
subroutine cam_thermo_dry_air_update(mmr, T, ncol, update_thermo_variables, to_dry_factor)
use air_composition, only: dry_air_composition_update
use air_composition, only: update_zvirv
- use string_utils, only: int2str
+ use string_utils, only: to_str
real(kind_phys), intent(in) :: mmr(:,:,:) ! constituents array (mmr = dry mixing ratio, if not use to_dry_factor to convert)
real(kind_phys), intent(in) :: T(:,:) ! temperature
@@ -1579,6 +1579,7 @@ subroutine get_hydrostatic_energy_1hd(tracer, moist_mixing_ratio, pdel_in, &
use cam_logfile, only: iulog
use dyn_tests_utils, only: vc_height, vc_moist_pressure, vc_dry_pressure
use air_composition, only: wv_idx
+ use air_composition, only: dry_air_species_num
use physconst, only: rga, latvap, latice
! Dummy arguments
diff --git a/src/data/registry.xml b/src/data/registry.xml
index e55e8a4c..de0c7439 100644
--- a/src/data/registry.xml
+++ b/src/data/registry.xml
@@ -16,6 +16,7 @@
$SRCROOT/src/data/ref_pres.meta
$SRCROOT/src/dynamics/utils/vert_coord.meta
$SRCROOT/src/dynamics/utils/hycoef.meta
+ $SRCROOT/src/dynamics/tests/dyn_tests_utils.meta
@@ -254,7 +255,7 @@
+ units="flag" type="logical">
flag indicating if is first timestep of initial run
@@ -422,8 +423,8 @@
zvir
Enthalpy or internal energy scaling factor for energy consistency
horizontal_dimension vertical_layer_dimension
diff --git a/src/dynamics/tests/dyn_tests_utils.meta b/src/dynamics/tests/dyn_tests_utils.meta
index 91f30f6d..d236ec6f 100644
--- a/src/dynamics/tests/dyn_tests_utils.meta
+++ b/src/dynamics/tests/dyn_tests_utils.meta
@@ -6,12 +6,12 @@
name = dyn_tests_utils
type = module
[ vc_dycore ]
- standard_name = vertical_coordinate_for_dynamical_core?
- units = none
+ standard_name = vertical_coordinate_for_dynamical_core_tbd
+ units = 1
type = integer
dimensions = ()
[ vc_physics ]
- standard_name = vertical_coordinate_for_physics?
- units = none
+ standard_name = vertical_coordinate_for_physics_tbd
+ units = 1
type = integer
dimensions = ()
diff --git a/src/dynamics/utils/dyn_thermo.F90 b/src/dynamics/utils/dyn_thermo.F90
index c4c4723c..9b465031 100644
--- a/src/dynamics/utils/dyn_thermo.F90
+++ b/src/dynamics/utils/dyn_thermo.F90
@@ -61,7 +61,7 @@ subroutine get_cp(tracer,inv_cp,cp,dp_dry,active_species_idx_dycore)
!Declare local variables:
real(kind_phys), allocatable :: tracer_phys(:,:,:,:)
real(kind_phys), allocatable :: cp_phys(:,:,:)
- real(kind_phys), allocatable :: dp_dry_phys(:,:,:)
+ real(kind_phys), allocatable :: factor_phys(:,:,:)
!check_allocate variables:
integer :: iret !allocate status integer
@@ -70,11 +70,16 @@ subroutine get_cp(tracer,inv_cp,cp,dp_dry,active_species_idx_dycore)
!Check if kinds are different:
if (kind_phys == kind_dyn) then
- !The dynamics and physics kind is the same, so just call the physics
- !routine directly:
- call get_cp_phys(tracer,inv_cp,cp, &
- dp_dry=dp_dry, &
- active_species_idx_dycore=active_species_idx_dycore)
+ ! The dynamics and physics kind is the same, so just call the physics
+ ! routine directly:
+ if(present(dp_dry)) then
+ call get_cp_phys(tracer,inv_cp,cp, &
+ factor=1.0_kind_phys/dp_dry, &
+ active_species_idx_dycore=active_species_idx_dycore)
+ else
+ call get_cp_phys(tracer,inv_cp,cp, &
+ active_species_idx_dycore=active_species_idx_dycore)
+ endif
else
@@ -95,18 +100,18 @@ subroutine get_cp(tracer,inv_cp,cp,dp_dry,active_species_idx_dycore)
!Allocate and set optional variables:
if (present(dp_dry)) then
- allocate(dp_dry_phys(size(dp_dry, 1), size(dp_dry, 2), size(dp_dry,3)), stat=iret)
+ allocate(factor_phys(size(dp_dry, 1), size(dp_dry, 2), size(dp_dry,3)), stat=iret)
call check_allocate(iret, subname, &
- 'dp_dry_phys', &
+ 'factor_phys', &
file=__FILE__, line=__LINE__)
!Set optional local variable:
- dp_dry_phys = real(dp_dry, kind_phys)
+ factor_phys = 1.0_kind_phys/real(dp_dry, kind_phys)
end if
- !Call physics routine using local vriables with matching kinds:
+ !Call physics routine using local variables with matching kinds:
call get_cp_phys(tracer_phys,inv_cp,cp_phys, &
- dp_dry=dp_dry_phys, &
+ factor=factor_phys, &
active_species_idx_dycore=active_species_idx_dycore)
!Set output variables back to dynamics kind:
@@ -116,8 +121,8 @@ subroutine get_cp(tracer,inv_cp,cp,dp_dry,active_species_idx_dycore)
deallocate(tracer_phys)
deallocate(cp_phys)
- if (allocated(dp_dry_phys)) then
- deallocate(dp_dry_phys)
+ if (allocated(factor_phys)) then
+ deallocate(factor_phys)
end if
@@ -957,7 +962,7 @@ subroutine get_rho_dry(tracer,temp,ptop,dp_dry,tracer_mass,&
end if
- !Call physics routine using local vriables with matching kinds:
+ !Call physics routine using local variables with matching kinds:
call get_rho_dry_phys(tracer_phys,temp_phys, &
ptop_phys, dp_dry_phys,tracer_mass, &
rho_dry=rho_dry_phys, &