-
Notifications
You must be signed in to change notification settings - Fork 16
Use default value for initial chemical species mixing ratios #405
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
Use default value for initial chemical species mixing ratios #405
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces hard-coded initial mixing ratios for chemical species with default values from the updated atmospheric_physics
MICM configuration, removes the obsolete MUSICA namelist module, and updates submodule references.
- Remove
musica_sima_namelist
and namelist reading/calls - Initialize TUV-x species from hard-coded list and MICM species via
default_value
- Update CAM-SIMA init and timestep routines to pass
constituent_properties
- Bump submodule tags for
atmospheric_physics
andcam-sima-chemistry-data
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/physics/utils/musica_sima_namelist.F90 | Deleted obsolete namelist module |
src/physics/utils/musica_ccpp_dependencies.F90 | Replaced MUSICA species logic with TUV-x array and MICM default_value |
src/control/runtime_opts.F90 | Removed call to musica_ccpp_dependencies_readnl |
src/control/cam_comp.F90 | Updated set_initial_musica_concentrations call to include properties |
cime_config/atm_musica_config.py | Updated CHEMISTRY_DATA_TAG |
.gitmodules | Updated atmospheric_physics submodule tag |
Comments suppressed due to low confidence (3)
src/physics/utils/musica_ccpp_dependencies.F90:157
- This
default_value
assignment introduces new behavior for setting initial mixing ratios from MICM species configuration. Consider adding unit tests to verify thatdefault_value
is correctly retrieved and applied for all species inmicm_species_set
.
call constituent_properties(i_constituent)%default_value( &
src/physics/utils/musica_ccpp_dependencies.F90:51
- [nitpick] The name
tuvx_species
may not clearly convey that this array holds initial mixing ratios. Consider renaming to something likeinitial_tuvx_species
ortuvx_initial_species
for better clarity.
type(species_t), allocatable :: tuvx_species(:)
src/physics/utils/musica_ccpp_dependencies.F90:147
- The use of FILE and LINE macros may not be supported by all Fortran compilers. Consider using a constant subroutine name parameter or the standard mechanisms (e.g., the ISO_FORTRAN_ENV module) to report file and line information.
call endrun(errmsg, file=__FILE__, line=__LINE__)
use cam_ccpp_cap, only: cam_constituents_array | ||
use cam_ccpp_cap, only: cam_model_const_properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] These two use cam_ccpp_cap
statements import symbols from the same module. Consider merging them into a single use cam_ccpp_cap
listing both cam_constituents_array
and cam_model_const_properties
to improve clarity.
use cam_ccpp_cap, only: cam_constituents_array | |
use cam_ccpp_cap, only: cam_model_const_properties | |
use cam_ccpp_cap, only: cam_constituents_array, cam_model_const_properties |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mattldawson!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mattldawson! I pushed up one last change to remove the musica_config
namelist variable from the definition file (as the namelist reader for it was already removed), but otherwise it looks good to me!
Also I think for now just setting the initial/default values for the chemical species only is fine, as some CAM physics schemes seem to require specialized initialization logic for their relevant constituent variables, and so until that is all sorted out it is probably safest to keep things separate. Thanks for checking though!
Tag name (required for release branches): sima0_06_001 Originator(s): @jimmielin Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number): ## Background Certain fields written in the CAM snapshot (e.g., `cam_in%cflx`) have a constituent dimension. Reading such snapshot fields is necessary for testing vertical diffusion which needs this field. Presently, the registry is configured to accept the definition of fields with a `number_of_ccpp_constituents` dimension but the initial value read infrastructure does not accept it with the error: `cflx already has an initial_value, using it now. It also cannot be read from file: cflx has unsupported dimension, number_of_ccpp_constituents.` This PR enables the reading of 2-D variables with the dimension `horizontal_dimension number_of_ccpp_constituents` with the ability to trivially expand it to 3-D fields in the future. ## Details * Because the CAM snapshot output constituent indices do not match the indices in the SIMA model, companion PR in CAM (ESCOMP/CAM#1336) will output `cam_in%cflx` as `cam_in_cflx_<constituent name>` (i.e., `cam_in_cflx_Q`, `cam_in_cflx_CLDICE`, ...) * A new interface `read_constituent_dimensioned_field` will read fields with a constituent dimension, reading variables one-by-one with a name constructed from a "base name" (`cam_in_cflx`) + "constituent short name" (`_Q`, `_CLDICE`, ...) * Because CAM is not aware of standard names, constituent names are mapped from standard names to short names (Q, CLDICE, ...) through the registry.xml initial value definitions. * Unit tests have been updated Tested by vertical diffusion work in progress code in SIMA. Describe any changes made to build system: * `write_init_files.py` updated infrastructure to allow constituent dimension input Describe any changes made to the namelist: N/A List any changes to the defaults for the input datasets (e.g. boundary datasets): * Snapshot format update - see ESCOMP/CAM#1336. This update is backwards compatible. List all files eliminated and why: N/A List all files added and what they do: ``` A test/unit/python/sample_files/phys_vars_init_check_constituent_dim.F90 A test/unit/python/sample_files/physics_inputs_constituent_dim.F90 A test/unit/python/sample_files/physics_types_simple_constituent_dim.F90 A test/unit/python/sample_files/physics_types_simple_constituent_dim.meta A test/unit/python/sample_files/write_init_files/phys_vars_init_check_constituent_dim.F90 A test/unit/python/sample_files/write_init_files/physics_inputs_constituent_dim.F90 A test/unit/python/sample_files/write_init_files/simple_reg_constituent_dim.xml A test/unit/python/sample_files/write_init_files/temp_adjust_constituent_dim.F90 A test/unit/python/sample_files/write_init_files/temp_adjust_constituent_dim.meta - new unit test (test_simple_constituent_dimensioned_var_write_init) for constituent-dimensioned input variable A test/unit/python/sample_files/physics_types_simple_initial_value.F90 A test/unit/python/sample_files/physics_types_simple_initial_value.meta - fix missing files from previously introduced test ``` List all existing files that have been modified, and describe the changes: (Helpful git command: `git diff --name-status development...<your_branch_name>`) ``` M src/data/write_init_files.py - add checks for number_of_ccpp_constituents as alternate last dimension - if number_of_ccpp_constituents is a dimension, call read_constituent_dimensioned_field instead of read_field - rearrange location of const_props for use by above feature. M src/physics/utils/physics_data.F90 - add interface read_constituent_dimensioned_field to read variables which have number_of_ccpp_constituents as dimension. M test/unit/python/test_write_init_files.py - new unit test (test_simple_constituent_dimensioned_var_write_init) for constituent-dimensioned input variable M test/unit/python/sample_files/write_init_files/physics_inputs_4D.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_bvd.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_cnst.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_ddt.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_ddt2.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_ddt_array.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_host_var.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_initial_value.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_mf.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_no_horiz.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_noreq.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_param.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_protect.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_scalar.F90 M test/unit/python/sample_files/write_init_files/physics_inputs_simple.F90 - updated sample files due to rearranging of const_props to top of subroutine. M test/unit/python/sample_files/write_init_files/simple_build_cache_template.xml M test/unit/python/sample_files/write_init_files/simple_reg.xml - fix typo and update hash for build cache template. M test/unit/python/sample_files/write_init_files/simple_reg_initial_value.xml - fix file name in xml. - fix allocatable should be allocatable (not pointer) if array has initial_value. ``` If there are new failures (compared to the `test/existing-test-failures.txt` file), have them OK'd by the gatekeeper, note them here, and add them to the file. If there are baseline differences, include the test and the reason for the diff. What is the nature of the change? Roundoff? derecho/intel/aux_sima: NLFAIL chemistry_nl - making baseline for #405 derecho/gnu/aux_sima: NLFAIL chemistry_nl - making baseline for #405 If this changes climate describe any run(s) done to evaluate the new climate in enough detail that it(they) could be reproduced: CAM-SIMA date used for the baseline comparison tests if different than latest: --------- Co-authored-by: Jesse Nusbaumer <nusbaume@ucar.edu>
Tag name (required for release branches):
Originator(s): Matt Dawson
Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number):
This PR updates to use a newer version of
atmospheric_physics
that includes setting thedefault_value
of constituent instances created for chemical species based on data in the MICM species configuration files. The updates to CAM-SIMA remove the hard-coded initial species mixing ratios for Terminator and Chapman mechanisms and instead set the initial mixing ratios for chemical species based on thedefault_value
of the corresponding constituent, which allows any mechanism to be run. This is needed to demonstrate the run-time configurability of the chemical system.@nusbaume - I wasn't sure if the logic for setting default values for constituents should be restricted to chemical species or not. If it makes sense to set this value for any constituent, I can modify this PR, but would need some guidance on where in the workflow to set the default value to avoid overwriting conditions explicitly set in other parts of the code.
Describe any changes made to build system:
updated commits for
atmospheric_physics
andcam-sima-chemistry-data
repos.Describe any changes made to the namelist:
none
List any changes to the defaults for the input datasets (e.g. boundary datasets):
none
List all files eliminated and why:
musica_sima_namelist.F90
- no namelist parameters are needed for musica now that CAM-SIMA is not restricted to Terminator and ChapmanList all files added and what they do:
none
List all existing files that have been modified, and describe the changes:
(Helpful git command:
git diff --name-status development...<your_branch_name>
)default_value
musica_ccpp_dependencies_readnl
set_initial_musica_concentrations
call to include properties for accessingdefault_value
CHEMISTRY_DATA_TAG
atmospheric_physics
submodule tagIf there are new failures (compared to the
test/existing-test-failures.txt
file),have them OK'd by the gatekeeper, note them here, and add them to the file.
If there are baseline differences, include the test and the reason for the
diff. What is the nature of the change? Roundoff?
will add after tests are run
derecho/intel/aux_sima:
derecho/gnu/aux_sima:
If this changes climate describe any run(s) done to evaluate the new
climate in enough detail that it(they) could be reproduced:
this should only affect chemistry
CAM-SIMA date used for the baseline comparison tests if different than latest: