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

Add new register phase #319

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "ccpp-framework"]
path = ccpp_framework
url = https://github.com/NCAR/ccpp-framework
fxtag = 2024-07-19-dev
fxtag = 2024-10-31-dev
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/NCAR/ccpp-framework
[submodule "history"]
Expand Down
2 changes: 1 addition & 1 deletion ccpp_framework
Submodule ccpp_framework updated 46 files
+1 −1 .github/workflows/capgen_unit_tests.yaml
+3 −49 scripts/ccpp_capgen.py
+0 −65 scripts/ccpp_datafile.py
+4 −1 scripts/ccpp_state_machine.py
+15 −12 scripts/ccpp_suite.py
+1 −1 scripts/ccpp_track_variables.py
+13 −49 scripts/constituents.py
+86 −10 scripts/host_cap.py
+1 −10 scripts/metadata_table.py
+1 −1 scripts/parse_tools/parse_checkers.py
+26 −3 scripts/parse_tools/xml_tools.py
+22 −1 scripts/suite_objects.py
+7 −0 scripts/var_props.py
+3 −0 src/ccpp_constituent_prop_mod.F90
+11 −0 src/ccpp_constituent_prop_mod.meta
+45 −0 test/advection_test/CMakeLists.txt
+28 −26 test/advection_test/cld_ice.F90
+25 −1 test/advection_test/cld_ice.meta
+27 −21 test/advection_test/cld_liq.F90
+25 −2 test/advection_test/cld_liq.meta
+9 −0 test/advection_test/cld_suite_error.xml
+3 −0 test/advection_test/cld_suite_files_error.txt
+41 −0 test/advection_test/dlc_liq.F90
+29 −0 test/advection_test/dlc_liq.meta
+4 −2 test/advection_test/run_test
+32 −2 test/advection_test/test_host.F90
+5 −3 test/advection_test/test_reports.py
+2 −0 test/capgen_test/run_test
+22 −0 test/capgen_test/temp_adjust.F90
+24 −0 test/capgen_test/temp_adjust.meta
+10 −0 test/capgen_test/test_host.F90
+1 −0 test/capgen_test/test_host_mod.F90
+7 −1 test/capgen_test/test_host_mod.meta
+1 −0 test/capgen_test/test_reports.py
+0 −1 test/unit_tests/sample_files/test_host.meta
+0 −96 test/unit_tests/sample_scheme_files/duplicate_dyn_const.F90
+0 −104 test/unit_tests/sample_scheme_files/duplicate_dyn_const.meta
+0 −75 test/unit_tests/sample_scheme_files/dyn_const_not_present.F90
+0 −104 test/unit_tests/sample_scheme_files/dyn_const_not_present.meta
+0 −100 test/unit_tests/sample_scheme_files/dyn_const_not_present_nested.F90
+0 −104 test/unit_tests/sample_scheme_files/dyn_const_not_present_nested.meta
+21 −21 test/unit_tests/sample_scheme_files/temp_adjust.F90
+32 −1 test/unit_tests/sample_scheme_files/temp_adjust.meta
+5 −38 test/unit_tests/test_metadata_scheme_file.py
+0 −3 test/unit_tests/test_metadata_table.py
+1 −1 test/var_compatibility_test/test_host.meta
5 changes: 5 additions & 0 deletions src/control/cam_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
use cam_initfiles, only: cam_initfiles_open
use dyn_grid, only: model_grid_init
use phys_comp, only: phys_init
use phys_comp, only: phys_register
use dyn_comp, only: dyn_init
! use cam_restart, only: cam_read_restart
use camsrfexch, only: hub2atm_alloc, atm2hub_alloc
Expand Down Expand Up @@ -186,6 +187,10 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
! Open initial or restart file, and topo file if specified.
call cam_initfiles_open()

! Call CCPP physics register phase (must happen before
! cam_register_constituents)
call phys_register()

! Initialize constituent information
! This will set the total number of constituents and the
! number of advected constituents.
Expand Down
11 changes: 1 addition & 10 deletions src/data/generate_registry_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1783,16 +1783,7 @@ def gen_registry(registry_file, dycore, outdir, indent,
logger, schema_path=schema_dir,
error_on_noxmllint=error_on_no_validate)
except CCPPError as ccpperr:
cemsg = f"{ccpperr}".split('\n', maxsplit=1)[0]
if cemsg[0:12] == 'Execution of':
xstart = cemsg.find("'")
if xstart >= 0:
xend = cemsg[xstart + 1:].find("'") + xstart + 1
emsg += '\n' + cemsg[xstart + 1:xend]
# end if (else, just keep original message)
elif cemsg[0:18] == 'validate_xml_file:':
emsg += "\n" + cemsg
# end if
emsg += f"\n{ccpperr}"
file_ok = False
# end try
if not file_ok:
Expand Down
2 changes: 1 addition & 1 deletion src/data/registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
allocatable="pointer">
<long_name>inverse exner function w.r.t. surface pressure (ps/p)^(R/cp)</long_name>
<dimensions>horizontal_dimension vertical_layer_dimension</dimensions>
<ic_file_input_names>exner state_exner</ic_file_input_names>
<ic_file_input_names>exner state_exner inverse_exner_function_wrt_surface_pressure</ic_file_input_names>
</variable>
<variable local_name="zm"
standard_name="geopotential_height_wrt_surface"
Expand Down
40 changes: 26 additions & 14 deletions src/physics/utils/phys_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module phys_comp
private

public :: phys_readnl
public :: phys_register
public :: phys_init
public :: phys_timestep_init
public :: phys_run1
Expand Down Expand Up @@ -129,25 +130,17 @@ subroutine phys_readnl(nlfilename)

end subroutine phys_readnl

subroutine phys_init()
use cam_abortutils, only: endrun
use physics_grid, only: columns_on_task
use vert_coord, only: pver, pverp
use cam_thermo, only: cam_thermo_init
use physics_types, only: allocate_physics_types_fields
use cam_ccpp_cap, only: cam_ccpp_physics_initialize
subroutine phys_register()
use cam_ccpp_cap, only: cam_ccpp_physics_register
use cam_ccpp_cap, only: ccpp_physics_suite_part_list
use cam_abortutils, only: endrun

! Local variables
integer :: i_group

call cam_thermo_init(columns_on_task, pver, pverp)

call allocate_physics_types_fields(columns_on_task, pver, pverp, &
set_init_val_in=.true., reallocate_in=.false.)
call cam_ccpp_physics_initialize(phys_suite_name)
call cam_ccpp_physics_register(phys_suite_name)
if (errcode /= 0) then
call endrun('cam_ccpp_physics_initialize: '//trim(errmsg))
call endrun('cam_ccpp_physics_register: '//trim(errmsg))
end if
call ccpp_physics_suite_part_list(phys_suite_name, suite_parts, &
errmsg, errcode)
Expand All @@ -158,12 +151,31 @@ subroutine phys_init()
! Confirm that the suite parts are as expected
do i_group = 1, size(suite_parts)
if (.not. any(suite_parts(i_group) == suite_parts_expect)) then
write(errmsg, *) 'phys_init: SDF suite groups MUST be ', &
write(errmsg, *) 'phys_register: SDF suite groups MUST be ', &
'ONLY `physics_before_coupler` and/or `physics_after_coupler`'
call endrun(errmsg)
end if
end do

end subroutine phys_register

subroutine phys_init()
use cam_abortutils, only: endrun
use physics_grid, only: columns_on_task
use vert_coord, only: pver, pverp
use cam_thermo, only: cam_thermo_init
use physics_types, only: allocate_physics_types_fields
use cam_ccpp_cap, only: cam_ccpp_physics_initialize

call cam_thermo_init(columns_on_task, pver, pverp)

call allocate_physics_types_fields(columns_on_task, pver, pverp, &
set_init_val_in=.true., reallocate_in=.false.)
call cam_ccpp_physics_initialize(phys_suite_name)
if (errcode /= 0) then
call endrun('cam_ccpp_physics_initialize: '//trim(errmsg))
end if

end subroutine phys_init

subroutine phys_timestep_init()
Expand Down
Loading