EAMxx: generalize multi-instance settings in driver
Is this just to make it so that the output nc files have different names for each instance? Perhaps we should handle this from inside our IO layer. We should have access to instance details from the driver, so we can simply fwd this to the IO layer (if non-trivial), and add it to the nc file name, like blah[.instance-sha].AVERAGE.ndays_x1.yyyy-mm-dd-xxxxx.nc (where the stuff inside [] is only added if the instance suffix is non-empty).
Originally posted by @bartgol in https://github.com/E3SM-Project/E3SM/pull/7789#discussion_r2433319984
One comment: I don't think the driver knows if this is the only instance or if there are more than one, right? We don't want to add the instance suffix also to tests that are not using the multi-instance feature...
@rljacob do you know if we can query the mct driver to see if there are 2+ instances or if we are in a single-instance case?
./xmlquery NINST_VALUE puts out a string I don't understand.
Since we have
./xmlquery NINST
NINST: ['ATM:1', 'LND:1', 'ICE:1', 'OCN:1', 'ROF:1', 'GLC:1', 'WAV:1', 'IAC:1', 'ESP:1']
can we use case.get_value(XYZ) to get the ATM value of NINST from inside our buildnml? Pinging @jgfouca as well.
I should have probably written more for better context:
- buildnml does handle this, see this PR fixing a bug regarding that for cice and eam: https://github.com/E3SM-Project/E3SM/pull/7792
- we can also explore how scream_input.yaml_???? is being set, see this line and thereabouts: https://github.com/E3SM-Project/E3SM/blob/9cfdf0175575d9592d7ce0048234c0a122cca743/components/eamxx/src/mct_coupling/atm_comp_mct.F90#L211
I just decided to punt on this because we need to get the RCS PR in sooner rather than later. Maybe Luca and I could iterate on this later?
Ah, then so long as we can access it from f90, we can forward the inst suffix (if any) to the cxx driver, which later passes it to the output mgrs.
was talking to @ndkeen about something related; we should probably integrate some of this stuff in soon
example change that starts generalizing things:
diff --git a/components/eamxx/cime_config/buildnml b/components/eamxx/cime_config/buildnml
index 154006057d..eff8dfd0e5 100755
--- a/components/eamxx/cime_config/buildnml
+++ b/components/eamxx/cime_config/buildnml
@@ -78,6 +78,14 @@ def buildnml(case, caseroot, compname):
# archive yaml/nml files in CaseDocs
archive_case_docs(caseroot)
+ # if we have a multi-instance setup, duplicate scream_input.yaml
+ ninst_atm = case.get_value("NINST_ATM")
+ if ninst_atm > 1:
+ for inst in range(1, ninst_atm + 1):
+ yaml_file = os.path.join(rundir, "data", "scream_input.yaml")
+ new_yaml_file = f"{yaml_file}_{inst:04d}"
+ safe_copy(yaml_file, new_yaml_file)
+
###############################################################################
def _main_func():
###############################################################################
we likely wanna do the same with the output specs maybe, but that may be a bit more work because our scream output setup is very flexible
@bartgol , yes, we should be able to case.get_value('ATM_NINST')