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

Implements CCPP-ized tropopause_find #293

Merged
merged 26 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2e063bc
Copy interpolatae_data.F90 utility routine from CAM; initial tropopau…
jimmielin Aug 14, 2024
a8986d8
Add cam_comp bindings for test build
jimmielin Aug 15, 2024
38d9b87
Add metadata for tropopause_read_file for inclusion in registry
jimmielin Aug 15, 2024
c801df4
Fix registry units for model_level_number_at_tropopause
jimmielin Aug 15, 2024
20fc030
Add messages for endrun calls in interpolate_data.F90
jimmielin Aug 15, 2024
9c5fc0a
Update tropopause_read_file subroutine name to avoid conflict with mo…
jimmielin Aug 15, 2024
6aa43a6
Update tropopause_read_file to CAM-SIMA subroutines
jimmielin Aug 15, 2024
e442cf5
Removal of POINTERs per CCPP-convention
jimmielin Aug 15, 2024
c22676b
Fix call to mark_as_initialized for calday (not read from initial file)
jimmielin Aug 15, 2024
cda5575
Read tropopause_nl within cam_comp
jimmielin Aug 16, 2024
f1d5409
Registry updates for tropopause_find
jimmielin Aug 16, 2024
f02c64e
Update for calculating methods needed by CAM and History output (regi…
jimmielin Aug 19, 2024
ff4d5ec
Update variable initialization
jimmielin Aug 19, 2024
8c15234
Fix tropp_days is fractional day-of-year
jimmielin Aug 20, 2024
d727997
Update git submodule to jimmielin/hplin/tropopause_find for inclusion…
jimmielin Aug 23, 2024
2777fae
Add diagnostic/history fillvalue to SIMA registry.
nusbaume Sep 6, 2024
a6cede2
Add check for valid numeric string in initial_value in generate_regis…
jimmielin Sep 9, 2024
4944a98
Update precision of fillvalue to kind_phys; allow this in the numeric…
jimmielin Sep 9, 2024
dcc322d
Update atmospheric_physics submodule to latest version from PR
jimmielin Sep 9, 2024
26319f1
Address review comments; update standard name to tropopause_air_press…
jimmielin Sep 18, 2024
c74a58a
Update atmospheric_physics external
jimmielin Sep 26, 2024
214c918
Update atmospheric_physics external to atmos_phys0_05_000
jimmielin Oct 1, 2024
f85cdf8
Update to address review comments:
jimmielin Oct 3, 2024
d494790
Merge branch 'development' into hplin/tropopause_find
jimmielin Oct 3, 2024
d226e34
Remove commented out code in namelist_definition_cam.xml
jimmielin Oct 3, 2024
d8f13a5
Change string length
jimmielin Oct 7, 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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[submodule "ncar-physics"]
path = src/physics/ncar_ccpp
url = https://github.com/ESCOMP/atmospheric_physics
fxtag = 098585940ad763be58ebab849bb8eaf325fda42a
fxtag = atmos_phys0_05_000
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
[submodule "ccs_config"]
Expand Down
15 changes: 14 additions & 1 deletion cime_config/namelist_definition_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,19 @@
</values>
</entry>

<!-- Tropopause -->
<entry id="tropopause_climo_file">
<type>char*256</type>
<category>tropopause</category>
<group>tropopause_nl</group>
<desc>
Full pathname of boundary dataset for tropopause climatology.
</desc>
<values>
<value>${DIN_LOC_ROOT}/atm/cam/chem/trop_mozart/ub/clim_p_trop.nc</value>
</values>
</entry>

<!-- Vertical Coordinate -->

<entry id="pver">
Expand Down Expand Up @@ -364,7 +377,7 @@
<group>cam_logfile_nl</group>
<valid_values>0,1,2,3</valid_values>
<desc>
Include exra checks and logging output.
Include extra checks and logging output.
0: No extra checks or output
1: Extra informational output
2: Level 1 plus extra checks and informational output
Expand Down
14 changes: 14 additions & 0 deletions src/control/cam_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ module cam_comp
use time_manager, only: timemgr_init, get_step_size
use time_manager, only: get_nstep
use time_manager, only: is_first_step, is_first_restart_step
use time_manager, only: get_curr_calday

use camsrfexch, only: cam_out_t, cam_in_t
use physics_types, only: phys_state, phys_tend
use physics_types, only: dtime_phys
use physics_types, only: calday
use dyn_comp, only: dyn_import_t, dyn_export_t

use perf_mod, only: t_barrierf, t_startf, t_stopf
Expand Down Expand Up @@ -98,6 +100,7 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
use physics_grid, only: columns_on_task
use vert_coord, only: pver
use phys_vars_init_check, only: mark_as_initialized
use tropopause_climo_read, only: tropopause_climo_read_file

! Arguments
character(len=cl), intent(in) :: caseid ! case ID
Expand Down Expand Up @@ -163,11 +166,16 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &

call cam_ctrl_set_orbit(eccen, obliqr, lambm0, mvelpp)


call timemgr_init( &
dtime, calendar, start_ymd, start_tod, ref_ymd, &
ref_tod, stop_ymd, stop_tod, curr_ymd, curr_tod, &
perpetual_run, perpetual_ymd, initial_run_in)

! Get current fractional calendar day. Needs to be updated at every timestep.
calday = get_curr_calday()
call mark_as_initialized('fractional_calendar_days_on_end_of_current_timestep')

! Read CAM namelists.
filein = "atm_in" // trim(inst_suffix)
call read_namelist(filein, single_column, scmlat, scmlon)
Expand Down Expand Up @@ -224,6 +232,9 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
!!XXgoldyXX: ^ need to import this
end if

! Read tropopause climatology
call tropopause_climo_read_file()

call phys_init()

!!XXgoldyXX: v need to import this
Expand Down Expand Up @@ -270,6 +281,9 @@ subroutine cam_timestep_init()
!
call phys_timestep_init()

! Update current fractional calendar day. Needs to be updated at every timestep.
calday = get_curr_calday()

end subroutine cam_timestep_init
!
!-----------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions src/control/runtime_opts.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon)
! use cam_diagnostics, only: diag_readnl
use inic_analytic_utils, only: analytic_ic_readnl

use tropopause_climo_read, only: tropopause_climo_readnl

! use tracers, only: tracers_readnl
! use nudging, only: nudging_readnl

Expand Down Expand Up @@ -99,6 +101,7 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon)
! call diag_readnl(nlfilename)
! call check_energy_readnl(nlfilename)
call analytic_ic_readnl(nlfilename)
call tropopause_climo_readnl(nlfilename)
! call scam_readnl(nlfilename, single_column, scmlat, scmlon)
! call nudging_readnl(nlfilename)

Expand Down
5 changes: 3 additions & 2 deletions src/data/generate_registry_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
sys.path.append(__SPINSCRIPTS)
# end if
_ALL_STRINGS_REGEX = re.compile(r'[A-Za-z][A-Za-z_0-9]+')
_FORTRAN_NUMERIC_REGEX = re.compile(r'^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?(_kind_phys)?$')

# CCPP framework imports
# pylint: disable=wrong-import-position
Expand Down Expand Up @@ -940,9 +941,9 @@ def add_variable(self, newvar):
all_strings = _ALL_STRINGS_REGEX.findall(newvar.initial_value)
init_val_vars = set()
excluded_initializations = {'null', 'nan', 'false', 'true'}
# Exclude NULL and nan variables
# Exclude NULL and nan variables and valid Fortran numeric values that pass the string regex (e.g. 1.e36, -3.2e5)
for var in all_strings:
if var.lower() not in excluded_initializations:
if var.lower() not in excluded_initializations and not _FORTRAN_NUMERIC_REGEX.match(newvar.initial_value):
init_val_vars.add(var)
# end if
# end if
Expand Down
15 changes: 15 additions & 0 deletions src/data/registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<metadata_file>$SRCROOT/src/data/physconst.meta</metadata_file>
<metadata_file>$SRCROOT/src/physics/utils/physics_grid.meta</metadata_file>
<metadata_file>$SRCROOT/src/physics/utils/cam_constituents.meta</metadata_file>
<metadata_file>$SRCROOT/src/physics/utils/tropopause_climo_read.meta</metadata_file>
<metadata_file>$SRCROOT/src/data/air_composition.meta</metadata_file>
<metadata_file>$SRCROOT/src/data/cam_thermo.meta</metadata_file>
<metadata_file>$SRCROOT/src/data/ref_pres.meta</metadata_file>
Expand Down Expand Up @@ -348,6 +349,12 @@
<long_name>current timestep number</long_name>
<initial_value>0</initial_value>
</variable>
<!-- Date and time variables -->
<variable local_name="calday"
standard_name="fractional_calendar_days_on_end_of_current_timestep"
nusbaume marked this conversation as resolved.
Show resolved Hide resolved
units="1" type="real" kind="kind_phys">
<long_name>fractional calendar day at end of current timestep</long_name>
</variable>
<!-- Error handling variables -->
<variable local_name="errcode"
standard_name="ccpp_error_code"
Expand All @@ -361,6 +368,14 @@
<long_name>ccpp error message</long_name>
<initial_value>''</initial_value>
</variable>
<!-- SIMA History (diagnostic output) variables -->
<variable local_name="fillvalue"
standard_name="fill_value_for_diagnostic_output"
units="1" type="real" kind="kind_phys"
allocatable="parameter">
<long_name>Fill value for diagnostic/history outputs</long_name>
<initial_value>1.e36_kind_phys</initial_value>
</variable>
<!-- Composition-dependent Variables -->
<variable local_name="cpairv"
standard_name="composition_dependent_specific_heat_of_dry_air_at_constant_pressure"
Expand Down
Loading
Loading