Conversation
Allow constant initialization of fields via an array of "name:value" strings, instead of requiring one XML entry per field. Since atmchange cannot remove individual params but can remove array entries, this lets users drop a default constant init (or add a new one) without touching the defaults file. - AtmosphereDriver::set_initial_conditions parses constant_fields and treats each entry like an individual constant IC entry (errors on malformed entries, or on duplicates with an individual entry). - Migrate the scalar, unconditional constant entries in namelist_defaults_eamxx.xml to the new array. Vector-valued and grid/compset-conditional entries stay as individual entries. - Exercise the new option in a dynamics_physics test input, and document. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lk8pmRsy19mr1ZkXWBgV2v
Contributor
|
…ields Fields can no longer be initialized via individual entries of the initial_conditions list (they could not be removed with atmchange, and required a new defaults-XML entry each). Instead: - constant_fields: array of "name:value" entries; vector fields accept "name:v1;v2;...;vN". - copy_fields: array of "tgt:src" entries (replaces 'tgt: src' strings). - Any other unrecognized parameter in initial_conditions is now an error. Defaults XML: all constant entries (including vector ones, dgnum etc.) now live in constant_fields; grid/compset-dependent ones are appended via append="last". All hand-written test yamls were migrated (0 semantic differences), and docs updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lk8pmRsy19mr1ZkXWBgV2v
- Migrate test yaml entries my first pass missed (keys written as 'name : value', e.g. pbl_height, phis), merging them into the existing constant_fields arrays. - Integer fields (e.g. sunlit_mask) must be initialized from an int: deep_copy of a double is a narrowing conversion and errors out. initialize_constant_field now converts integral values for IntType fields, and errors on non-integral ones. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lk8pmRsy19mr1ZkXWBgV2v
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lk8pmRsy19mr1ZkXWBgV2v
test_atmchanges_on_arrays relied on the dgnum param, which is now an entry of initial_conditions::constant_fields. Exercise atmchange on that array instead (including a vector-valued entry). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lk8pmRsy19mr1ZkXWBgV2v
mahf708
reviewed
Sep 30, 2026
|
|
||
| z_mam4_int : 0.0 | ||
| constant_fields: | ||
| - "pbl_height:0.0" |
Contributor
There was a problem hiding this comment.
this may be confusing to people (due to the quotes) but I think we may be able to avoid it altogether, yaml will still parse them correctly like above as a nested list, but you will need to come up with a better type than type="array(string)" in the xml
Contributor
Author
|
CI status on
Generated by Claude Code |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace per-field entries in the EAMxx
initial_conditionslist with two arrays,constant_fieldsandcopy_fields. Entries can be added or removed with atmchange.Motivation
Constant initialization of a field needed an individual entry in
namelist_defaults_eamxx.xml(e.g.<sfc_alb_dif_vis>0.0</sfc_alb_dif_vis>). Individual params cannot be removed withatmchange, but array entries can.Design
This is a breaking change. Named fields are no longer supported in
initial_conditions. Any testmod or user script doingatmchange initial_conditions::qr=...must switch to the array syntax. The driver now errors on any unrecognized parameter in the list, so stale inputs fail loudly instead of being silently ignored.constant_fieldsis anarray(string)of entriesname:value.name:v1;v2;...;vNsets componentitovi. A single value is broadcast to all components.;is used for the components because,is the array separator. From the shell the argument must be quoted:./atmchange initial_conditions::constant_fields+="dgnum:1e-7;2e-8;3e-7;4e-8".copy_fieldsis anarray(string)of entriestgt:src. It replaces the oldtgt: srcstring entries. That feature is only used byad_tests.yaml, but it also needed a home once named entries were removed.initial_conditionsparameters are now:filename,topography_filename,constant_fields,copy_fields,perturbed_fields, and theperturbation_*/generate_perturbation_random_seedoptions.Changes
AtmosphereDriver::set_initial_conditions: parse and validate the two arrays.initialize_constant_fieldnow takesstd::vector<double>.namelist_defaults_eamxx.xml:constant_fieldsholds all 61 scalar entries plus the vector ones (dgnum,dgnumwet,wetdens).qc,qi,nc,ni,o3_volume_mix_ratio,phisfor aquaplanet) are appended viaappend="last".copy_fieldsdefault is added so it can be edited with atmchange.wetdep_*/drydep_*entries were dropped.model_configuration.mdandtesting_for_development.md.Testing
The full EAMxx build and tests have not been run, so please run CI, in particular the EAMxx standalone and v1 tests. What I did check:
ParameterList. It gives the expected values, and each error case (unknown param, bad or empty value, duplicate, in both arrays) errors as intended.evaluate_selectorson the defaults XML resolvesconstant_fieldscorrectly for ne4, ne32, ne1024, aquaplanet and conus: 64 base entries, plus 4 / 2 / 1 / 1 conditional entries.atmchange-=and+=work on the new arrays.🤖 Generated with Claude Code
https://claude.ai/code/session_01Lk8pmRsy19mr1ZkXWBgV2v