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

Integration of CCPP-ized TJ2016 implementation #271

Merged
merged 30 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e4fa834
Updating Externals_CAM.cfg to point to tj2016 atmospheric physics fork.
mwaxmonsky Mar 1, 2024
81224d5
Resolving merge conflicts with Externals_CAM.cfg
mwaxmonsky Mar 15, 2024
19e1586
Merging in updates from ccpp-framework and atmospheric_physcis. Upda…
mwaxmonsky Mar 15, 2024
680d5a8
Updates based on bug fixes and feedback.
mwaxmonsky Apr 3, 2024
fc35548
Updating to latest atmos_phys changes.
mwaxmonsky Apr 15, 2024
0eb4e8f
Merge branch 'development' into tj2016
mwaxmonsky Apr 25, 2024
dcb4a5c
Merge branch 'development' into tj2016
mwaxmonsky May 10, 2024
f76b038
Standard names update.
mwaxmonsky Jun 7, 2024
0f53092
Update to latest atmos_phys
mwaxmonsky Jun 7, 2024
7591a27
Update to match generated code from capgen.
mwaxmonsky Jun 7, 2024
222227a
Updating to latest atmos_phys.
mwaxmonsky Jun 14, 2024
138f410
Updating to latest atmos_phys.
mwaxmonsky Jun 17, 2024
c561a98
Updating to latest atmos_phys.
mwaxmonsky Jun 25, 2024
279a2ca
Fixing merge conflict with branch development
mwaxmonsky Jun 27, 2024
70c235c
Removing standard names csv file as no longer needed.
mwaxmonsky Jun 27, 2024
8a64782
Moving input names to standard names xml generator to tools directory.
mwaxmonsky Jun 27, 2024
dfd52b1
Updating to latest development ccpp-framework.
mwaxmonsky Jun 27, 2024
f63ebf2
Removing commented code and updating standard name.
mwaxmonsky Jun 27, 2024
3ac1b72
Fixing pylint errors.
mwaxmonsky Jul 1, 2024
6024452
Removing anomalous backslash in regex string by using raw string.
mwaxmonsky Jul 8, 2024
5a7c176
Adding missing docstrings.
mwaxmonsky Jul 9, 2024
0fe3378
Merge branch 'development' into tj2016
mwaxmonsky Jul 11, 2024
7e8562b
Addressing review comments.
mwaxmonsky Jul 12, 2024
dbdbbad
Addressing review comments and adding error checking to PIO calls.
mwaxmonsky Jul 15, 2024
0f673e2
Addressing review comments. Updating tphys variable name to better c…
mwaxmonsky Jul 15, 2024
f975f18
Adding build tests for tj2016.
mwaxmonsky Jul 15, 2024
039ae66
Removing izumi test defs.
mwaxmonsky Jul 15, 2024
c81084a
Adding complimentary compiler tests so each works with gnu and intel.
mwaxmonsky Jul 15, 2024
223f3fe
Adding error handling debug statements.
mwaxmonsky Jul 19, 2024
3f58522
Resolving merge conflicts merging 'development' into 'tj2016'.
mwaxmonsky Jul 23, 2024
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
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)
peverwhee marked this conversation as resolved.
Show resolved Hide resolved
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)
peverwhee marked this conversation as resolved.
Show resolved Hide resolved
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)
nusbaume marked this conversation as resolved.
Show resolved Hide resolved
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
Loading