Skip to content

Commit

Permalink
Integration of CCPP-ized TJ2016 implementation (#271)
Browse files Browse the repository at this point in the history
Updates atmospheric_physics to the latest tag bringing in TJ2016
capability and additional changes needed in support of TJ2016.

URL: #271

Describe any changes made to build system: N/A

Describe any changes made to the namelist: N/A

List any changes to the defaults for the boundary datasets: N/A

Describe any substantial timing or memory changes: N/A

Code reviewed by: nusbaume, peverwhee

List all existing files that have been modified, old files eliminated,
new files added and describe the changes:

M       Externals_CAM.cfg
- Updating to latest CCPP Framework needed for build.
- Updating to latest atmospheric_physics needed to bring in TJ2016.

M       src/control/cam_comp.F90
- Removing CAM suite and dynamic_constituents to match new API.

M       src/data/physconst.meta
- Updating two standard names.

M       src/data/registry.xml
A       src/dynamics/utils/hycoef.meta
- Exposing
sum_of_sigma_pressure_hybrid_coordinate_a_coefficient_and_sigma_pressure_hybrid_coordinate_b_coefficient
(etamid) to physics schemes.

M       src/dynamics/utils/hycoef.F90
- Updating lev, ilev, hybi, hyai to be read in by their standard names
and updating PIO checks appropriately.

A       tools/generate_input_to_stdnames_update.py
- Adding new script to convert CSV file exported from standard names
spreadsheet into the inputnames_dictionary.xml

M       tools/inputnames_to_stdnames.py
- Updating script to be tphysac/tphysbc aware to avoid duplicate
standard names in snapshots.

M       tools/stdnames_to_inputnames_dictionary.xml
- Adding missing entry for standard_gravitational_acceleration.

M       cime_config/testdefs/testlist_cam.xml
D        cime_config/testdefs/testmods_dirs/cam/outfrq_held_suarez_izumi_nooutput/shell_commands
D        cime_config/testdefs/testmods_dirs/cam/outfrq_held_suarez_izumi_nooutput/user_nl_cam
D        cime_config/testdefs/testmods_dirs/cam/outfrq_kessler_izumi_nooutput/shell_commands
D        cime_config/testdefs/testmods_dirs/cam/outfrq_kessler_izumi_nooutput/user_nl_cam
A        cime_config/testdefs/testmods_dirs/cam/outfrq_tj2016_derecho_nooutput/shell_commands
A        cime_config/testdefs/testmods_dirs/cam/outfrq_tj2016_derecho_nooutput/user_nl_cam
- Adding derecho build test for tj2016, updating existing tests to build
using both compilers (gnu and intel) and removing izumi tests based on
discussion from 7/15/24 to simplify test setup process.

If there were any failures reported from running test_driver.sh on any
test platform, and check in with these failures has been OK'd by the
gatekeeper, then copy the lines from the td.*.status files for the failed tests to
the appropriate machine below.  All failed tests must be justified.

derecho/intel/aux_cam
derecho/gnu/aux_cam
- All tests pass.

Summarize any changes to answers, i.e.,
- what code configurations: N/A
- what platforms/compilers: N/A
- nature of change (roundoff; larger than roundoff but same climate; new
climate): N/A
  • Loading branch information
mwaxmonsky authored Jul 23, 2024
1 parent 4609b76 commit 40d1804
Show file tree
Hide file tree
Showing 18 changed files with 260 additions and 57 deletions.
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "ccpp-framework"]
path = ccpp_framework
url = https://github.com/peverwhee/ccpp-framework
fxtag = CPF_0.2.056
url = https://github.com/NCAR/ccpp-framework
fxtag = 2024-07-11-dev
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/peverwhee/ccpp-framework
fxDONOTUSEurl = https://github.com/NCAR/ccpp-framework
[submodule "mpas"]
path = src/dynamics/mpas/dycore
url = https://github.com/MPAS-Dev/MPAS-Model.git
Expand All @@ -14,7 +14,7 @@
[submodule "ncar-physics"]
path = src/physics/ncar_ccpp
url = https://github.com/ESCOMP/atmospheric_physics
fxtag = atmos_phys0_02_006
fxtag = atmos_phys0_03_000
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
[submodule "ccs_config"]
Expand Down
2 changes: 1 addition & 1 deletion ccpp_framework
Submodule ccpp_framework updated 101 files
42 changes: 17 additions & 25 deletions cime_config/testdefs/testlist_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,53 @@
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_kessler_derecho_nooutput/">
<machines>
<machine name="derecho" compiler="intel" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
<option name="comment" >Intel build test for Kessler physics</option>
</options>
</test>
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_held_suarez_derecho_nooutput/">
<machines>
<machine name="derecho" compiler="gnu" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
<option name="comment" >GNU build test for Held-Suarez physics</option>
<option name="comment">Intel build test for Kessler physics</option>
</options>
</test>

<!-- Derecho dycore tests -->
<test compset="FKESSLER" grid="mpasa480_mpasa480" name="SMS_Ln2" testmods="cam/outfrq_kessler_mpas_derecho_nooutput/">
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_held_suarez_derecho_nooutput/">
<machines>
<machine name="derecho" compiler="intel" category="aux_sima"/>
<machine name="derecho" compiler="gnu" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
<option name="comment" >GNU build test for MPAS dycore (with Kessler physics)</option>
<option name="comment">GNU build test for Held-Suarez physics</option>
</options>
</test>
<test compset="FKESSLER" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_kessler_se_cslam_derecho_nooutput/">
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_tj2016_derecho_nooutput/">
<machines>
<machine name="derecho" compiler="intel" category="aux_sima"/>
<machine name="derecho" compiler="gnu" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
<option name="comment" >GNU build test for SE-CSLAM dycore (with Kessler physics)</option>
<option name="comment">GNU build test for Moist Held-Suarez physics</option>
</options>
</test>
</tests>

<!-- Izumi physics tests -->
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_kessler_izumi_nooutput/">
<!-- Derecho dycore tests -->
<test compset="FKESSLER" grid="mpasa480_mpasa480" name="SMS_Ln2" testmods="cam/outfrq_kessler_mpas_derecho_nooutput/">
<machines>
<machine name="izumi" compiler="gnu" category="aux_sima"/>
<machine name="derecho" compiler="intel" category="aux_sima"/>
<machine name="derecho" compiler="gnu" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
<option name="comment" >GNU build test for Kessler physics</option>
<option name="comment">GNU build test for MPAS dycore (with Kessler physics)</option>
</options>
</test>
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_held_suarez_izumi_nooutput/">
<test compset="FKESSLER" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_kessler_se_cslam_derecho_nooutput/">
<machines>
<machine name="izumi" compiler="gnu" category="aux_sima"/>
<machine name="derecho" compiler="intel" category="aux_sima"/>
<machine name="derecho" compiler="gnu" category="aux_sima"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
<option name="comment" >GNU build test for Held-Suarez physics</option>
<option name="comment">GNU build test for SE-CSLAM dycore (with Kessler physics)</option>
</options>
</test>


</testlist>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./xmlchange CAM_CONFIG_OPTS="--dyn none --physics-suites tj2016"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ncdata=/glade/campaign/cesm/community/amwg/sima_baselines/cam_sima_test_snapshots/cam_tj2016_precip_tend_ne3pg3mg37_derecho_gnu_before.nc
ncdata_check=/glade/campaign/cesm/community/amwg/sima_baselines/cam_sima_test_snapshots/cam_tj2016_precip_tend_ne3pg3mg37_derecho_gnu_after.nc
debug_output=0
pver=30
4 changes: 2 additions & 2 deletions src/control/cam_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,8 @@ subroutine cam_register_constituents(cam_runtime_opts)

!Combine host and physics constituents into a single
!constituents object:
call cam_ccpp_register_constituents(cam_runtime_opts%suite_as_list(), &
host_constituents, dynamic_constituents, errcode=errflg, errmsg=errmsg)
call cam_ccpp_register_constituents( &
host_constituents, errcode=errflg, errmsg=errmsg)

if (errflg /= 0) then
call endrun(subname//trim(errmsg), file=__FILE__, line=__LINE__)
Expand Down
4 changes: 2 additions & 2 deletions src/data/physconst.meta
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
dimensions = ()
protected = True
[ gravit ]
standard_name = gravitational_acceleration
standard_name = standard_gravitational_acceleration
units = m s-2
type = real | kind = kind_phys
dimensions = ()
Expand Down Expand Up @@ -268,7 +268,7 @@
dimensions = ()
protected = True
[ epsilo ]
standard_name = ratio_of_h2o_to_dry_air_molecular_weights
standard_name = ratio_of_water_vapor_to_dry_air_molecular_weights
units = 1
type = real | kind = kind_phys
dimensions = ()
Expand Down
1 change: 1 addition & 0 deletions src/data/registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<metadata_file>$SRCROOT/src/data/cam_thermo.meta</metadata_file>
<metadata_file>$SRCROOT/src/data/ref_pres.meta</metadata_file>
<metadata_file>$SRCROOT/src/dynamics/utils/vert_coord.meta</metadata_file>
<metadata_file>$SRCROOT/src/dynamics/utils/hycoef.meta</metadata_file>
<!-- Variables registered to physics_types -->
<file name="physics_types" type="module">
<use module="ccpp_kinds" reference="kind_phys"/>
Expand Down
80 changes: 74 additions & 6 deletions src/dynamics/utils/hycoef.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module hycoef

use shr_kind_mod, only: r8 => shr_kind_r8
use ccpp_kinds, only: kind_phys
use spmd_utils, only: masterproc
use vert_coord, only: pver, pverp
use cam_logfile, only: iulog
Expand Down Expand Up @@ -28,8 +29,6 @@ module hycoef
real(r8), public, allocatable, target :: hybi(:) ! ps component of hybrid coordinate - interfaces
real(r8), public, allocatable, target :: hybm(:) ! ps component of hybrid coordinate - midpoints

real(r8), public, allocatable :: etamid(:) ! hybrid coordinate - midpoints

real(r8), public, allocatable :: hybd(:) ! difference in b (hybi) across layers
real(r8), public, allocatable :: hypi(:) ! reference pressures at interfaces
real(r8), public, allocatable :: hypm(:) ! reference pressures at midpoints
Expand All @@ -47,6 +46,10 @@ module hycoef
type(var_desc_t) :: hyam_desc, hyai_desc, hybm_desc, hybi_desc, p0_desc
public init_restart_hycoef, write_restart_hycoef

!> \section arg_table_hycoef Argument Table
!! \htmlinclude hycoef.html
real(kind_phys), allocatable, public :: etamid(:) ! hybrid coordinate - midpoints

!=======================================================================
contains
!=======================================================================
Expand All @@ -56,6 +59,7 @@ subroutine hycoef_init(file, psdry)
! use cam_history_support, only: add_hist_coord, add_vert_coord, formula_terms_t
use physconst, only: pref
use string_utils, only: to_str
use phys_vars_init_check, only: mark_as_initialized

!-----------------------------------------------------------------------
!
Expand Down Expand Up @@ -326,6 +330,11 @@ subroutine hycoef_init(file, psdry)
write(iulog,9830) pverp, hypi(pverp)
end if

! Mark etamid (input name) as initialized (by standard name sum_of_sigma_...)
call mark_as_initialized( &
'sum_of_sigma_pressure_hybrid_coordinate_a_coefficient_and_sigma_pressure_hybrid_coordinate_b_coefficient')


9800 format( 1x, i3, 3p, 3(f10.4,10x) )
9810 format( 1x, 3x, 3p, 3(10x,f10.4) )
9820 format(1x,'reference pressures (Pa)')
Expand Down Expand Up @@ -394,42 +403,101 @@ subroutine hycoef_read(File)
character(len=*), parameter :: routine = 'hycoef_read'
!----------------------------------------------------------------------------

! Set PIO to return error codes.
call pio_seterrorhandling(file, PIO_BCAST_ERROR, pio_errtype)

! PIO traps errors internally, no need to check ierr

ierr = PIO_Inq_DimID(File, 'lev', lev_dimid)
if (ierr /= PIO_NOERR) then
ierr = PIO_Inq_DimID(File, 'reference_pressure_in_atmosphere_layer', lev_dimid)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: unable to find lev dimension in ncdata or restart file.')
end if
end if
ierr = PIO_Inq_dimlen(File, lev_dimid, flev)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: Failed to inquire dimension length of flev in ncdata or restart file.')
end if
if (pver /= flev) then
write(iulog,*) routine//': ERROR: file lev does not match model. lev (file, model):',flev, pver
call endrun(routine//': ERROR: file lev does not match model.')
end if

ierr = PIO_Inq_DimID(File, 'ilev', lev_dimid)
if (ierr /= PIO_NOERR) then
ierr = PIO_Inq_DimID(File, 'reference_pressure_in_atmosphere_layer_at_interfaces', lev_dimid)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: unable to find ilev dimension in ncdata or restart file')
end if
end if
ierr = PIO_Inq_dimlen(File, lev_dimid, filev)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: Failed to inquire dimension length of filev in ncdata or restart file.')
end if
if (pverp /= filev) then
write(iulog,*) routine//':ERROR: file ilev does not match model ilev (file, model):',filev, pverp
call endrun(routine//':ERROR: file ilev does not match model.')
end if

ierr = pio_inq_varid(File, 'hyai', hyai_desc)
if (ierr /= PIO_NOERR) then
ierr = pio_inq_varid(File, 'sigma_pressure_hybrid_coordinate_a_coefficient_at_interfaces', hyai_desc)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: unable to find hyai variable in ncdata or restart file')
end if
end if

ierr = pio_inq_varid(File, 'hyam', hyam_desc)
if (ierr /= PIO_NOERR) then
ierr = pio_inq_varid(File, 'sigma_pressure_hybrid_coordinate_a_coefficient', hyam_desc)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: unable to find hyam variable in ncdata or restart file')
end if
end if

ierr = pio_inq_varid(File, 'hybi', hybi_desc)
if (ierr /= PIO_NOERR) then
ierr = pio_inq_varid(File, 'sigma_pressure_hybrid_coordinate_b_coefficient_at_interfaces', hybi_desc)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: unable to find hybi variable in ncdata or restart file')
end if
end if

ierr = pio_inq_varid(File, 'hybm', hybm_desc)
if (ierr /= PIO_NOERR) then
ierr = pio_inq_varid(File, 'sigma_pressure_hybrid_coordinate_b_coefficient', hybm_desc)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: unable to find hybm variable in ncdata or restart file')
end if
end if

ierr = pio_get_var(File, hyai_desc, hyai)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: Unable to get hyai variable in ncdata or restart file.')
end if
ierr = pio_get_var(File, hybi_desc, hybi)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: Unable to get hybi variable in ncdata or restart file.')
end if
ierr = pio_get_var(File, hyam_desc, hyam)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: Unable to get hyam variable in ncdata or restart file.')
end if
ierr = pio_get_var(File, hybm_desc, hybm)
if (ierr /= PIO_NOERR) then
call endrun(routine//': ERROR: Unable to get hybm variable in ncdata or restart file.')
end if

if (masterproc) then
write(iulog,*) routine//': read hyai, hybi, hyam, hybm'
end if

! Check whether file contains value for P0. If it does then use it

! Set PIO to return error codes.
call pio_seterrorhandling(file, PIO_BCAST_ERROR, pio_errtype)

ierr = pio_inq_varid(file, 'P0', p0_desc)
if (ierr /= PIO_NOERR) then
ierr = pio_inq_varid(File, 'surface_reference_pressure', p0_desc)
end if
if (ierr == PIO_NOERR) then
ierr = pio_get_var(file, p0_desc, ps0)
if (ierr /= PIO_NOERR) then
Expand Down
13 changes: 13 additions & 0 deletions src/dynamics/utils/hycoef.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[ccpp-table-properties]
name = hycoef
type = module
[ccpp-arg-table]
name = hycoef
type = module

[ etamid ]
standard_name = sum_of_sigma_pressure_hybrid_coordinate_a_coefficient_and_sigma_pressure_hybrid_coordinate_b_coefficient
type = real | kind = kind_phys
units = 1
dimensions = (vertical_layer_dimension)

Loading

0 comments on commit 40d1804

Please sign in to comment.