Replace ccs_config edits with xmlchange #20
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.
Problem:
https://github.com/CROCODILE-CESM/CrocoDash uses VisualCaseGen for case creation for regional domains. As such, we follow a similar workflow of checking out a CESM sandbox to generate cases. However, VisualCaseGen installs with a CESM sandbox that is directly connected to it. CrocoDash does not need all of the functionality that visualCaseGen comes with, and doesn't necessarily need the user to install a CESM sandbox -> they should be able to use anybody's sandbox.
However, VCG creates cases by creating - just like a compset alias - a grid alias for the custom regional cases CrocoDash needs. This is done by editing two files in CESM inside of a folder called ccs_config:
modelgrid_aliases&component_grids_noupc. How it works is that the aliases are saved inside themodelgrid_aliases, and those have shortnames pointing to specific components grids in thecomponent_grids_noupcfile. VisualCaseGen adds a new alias per case into themodelgrid_aliases, and adds any necessary new grids to thecomponent_grids_noupcfolder.Editing these files requires write permission for the user, so it blocks CrocoDash users from using other's sandbox by default (they have to be given permission). It also could be argued that adding the grids to the CESM makes it more confusing for the users, because the grids aren't directly pointed to in the case but in the CESM, but that's just my opinion. This PR only springs up because Mike didn't like the idea of CrocoDash editing CESM sandboxes.
So, to solve this issue, VisualCaseGen needs to create cases without editing CESM sandboxes.
Choices/Changes Made:
One choice that was made was not to use grid long names. Grids, like compsets, can be specified with long names instead of aliases. However, I learned you have to specify the entire longname, including runoff, wave, glc,etc.. grids and not just specify some that you know. The alias method allows you to take advantage of defaults. For example, if you specify DROF, the corresponding grid is selected without having to point to a specific grid manually. VisualCaseGen only touches the atm, lnd, and ocn grids, so it's not realistic (even though it would probably be slightly cleaner) to specify the grid long names, because then we would need infrastructure to specify every component grid, which is not currently supported (It wouldn't be that hard, but it's a lot of extra overhead for a usecase that's not even part of the GUI). It's also not flexible to new components/compset definitions and you lose all of the CIME support for flexible creating your grids from the compsets.
So the choice that was made is: We're gonna need at least one alias!! So if we call in "visualCaseGen_Custom" and specify dummy values for the components that visualCaseGen does touch in custom mode, which is atm, lnd, and ocn. We let CIME handle the runoff, glc, wav, etc.. grids through the compset.
So by default the ocn grid is set to "visualCaseGen_Custom" , which is a 1by1 grid with a random mesh, the atm, and lnd are None. The atm/lnd grid are unset when the case is created with
create_newcase. Immeditately after that, we introduce a new function called_update_grids, which replaces the previous edits to ccs_config with xml changes. We set the atm and lnd grids (xml vars{COMP}_GRID) to the cvars variableCUSTOM_{COMP}_GRID(which I don't understand that well). Because setting the{COMP}_GRIDvariable doesn't change the associated mesh for atm&lnd, we use the self._cime object to set the{COMP}_DOMAIN_MESHxml variable as well for atm, ocn, and lnd.We don't change the
OCN_GRIDvariable because it is not out of the box in the way atm/lnd are, it is truly visualCaseGen_CustomFormal Changes (TLDR):
case_creatorwith an xml variable grid change function called_update_gridsrevert_launchfunction to reflect this changeOutstanding Issues:
ww3a(because the alias doesn't matter we can use anything )CrocoDash case with this PR Coupler history: /glade/u/home/manishrv/scratch/archive/test.4.vcg.xmlchange/cpl/hist