diff --git a/config/cesm/config_files.xml b/config/cesm/config_files.xml index f99170bb03d..298dc543740 100644 --- a/config/cesm/config_files.xml +++ b/config/cesm/config_files.xml @@ -87,6 +87,7 @@ $SRCROOT/cime_config/config_compsets.xml $CIMEROOT/src/drivers/mct/cime_config/config_compsets.xml + $CIMEROOT/src/drivers/nuopc/cime_config/config_compsets.xml $SRCROOT/components/cam/cime_config/config_compsets.xml $SRCROOT/components/cism/cime_config/config_compsets.xml $SRCROOT/components/clm/cime_config/config_compsets.xml @@ -106,6 +107,7 @@ $SRCROOT/cime_config/config_pes.xml $CIMEROOT/src/drivers/mct/cime_config/config_pes.xml + $CIMEROOT/src/drivers/nuopc/cime_config/config_pes.xml $SRCROOT/components/cam/cime_config/config_pes.xml $SRCROOT/components/cism/cime_config/config_pes.xml $SRCROOT/components/clm/cime_config/config_pes.xml @@ -167,6 +169,7 @@ $SRCROOT/cime_config/testlist_allactive.xml $CIMEROOT/src/drivers/mct/cime_config/testdefs/testlist_drv.xml + $CIMEROOT/src/drivers/nuopc/cime_config/testdefs/testlist_drv.xml $SRCROOT/components/cam/cime_config/testdefs/testlist_cam.xml $SRCROOT/components/cism/cime_config/testdefs/testlist_cism.xml $SRCROOT/components/clm/cime_config/testdefs/testlist_clm.xml @@ -187,6 +190,7 @@ $SRCROOT/cime_config/testmods_dirs $CIMEROOT/src/drivers/mct/cime_config/testdefs/testmods_dirs + $CIMEROOT/src/drivers/nuopc/cime_config/testdefs/testmods_dirs $SRCROOT/components/cam/cime_config/testdefs/testmods_dirs $SRCROOT/components/cism/cime_config/testdefs/testmods_dirs $SRCROOT/components/clm/cime_config/testdefs/testmods_dirs @@ -206,6 +210,7 @@ $SRCROOT/cime_config/usermods_dirs $CIMEROOT/src/drivers/mct/cime_config/usermods_dirs + $CIMEROOT/src/drivers/nuopc/cime_config/usermods_dirs $SRCROOT/components/cam/cime_config/usermods_dirs $SRCROOT/components/cism/cime_config/usermods_dirs $SRCROOT/components/clm/cime_config/usermods_dirs @@ -225,9 +230,12 @@ char unset - $CIMEROOT/src/drivers/mct/cime_config/namelist_definition_modelio.xml - $CIMEROOT/src/drivers/mct/cime_config/namelist_definition_drv_flds.xml - $CIMEROOT/src/drivers/mct/cime_config/namelist_definition_drv.xml + $CIMEROOT/src/drivers/mct/cime_config/namelist_definition_modelio.xml + $CIMEROOT/src/drivers/nuopc/cime_config/namelist_definition_modelio.xml + $CIMEROOT/src/drivers/mct/cime_config/namelist_definition_drv_flds.xml + $CIMEROOT/src/drivers/nuopc/cime_config/namelist_definition_drv_flds.xml + $CIMEROOT/src/drivers/mct/cime_config/namelist_definition_drv.xml + $CIMEROOT/src/drivers/nuopc/cime_config/namelist_definition_drv.xml $CIMEROOT/src/components/data_comps/drof/cime_config/namelist_definition_drof.xml $CIMEROOT/src/components/data_comps/datm/cime_config/namelist_definition_datm.xml @@ -257,7 +265,11 @@ char - $CIMEROOT/src/drivers/mct/cime_config/config_component.xml + unset + + $CIMEROOT/src/drivers/mct/cime_config/config_component.xml + $CIMEROOT/src/drivers/nuopc/cime_config/config_component.xml + case_last env_case.xml file containing all non-component specific case configuration variables (for documentation only - DO NOT EDIT) @@ -266,7 +278,11 @@ char - $CIMEROOT/src/drivers/mct/cime_config/config_component_$MODEL.xml + unset + + $CIMEROOT/src/drivers/mct/cime_config/config_component_$MODEL.xml + $CIMEROOT/src/drivers/nuopc/cime_config/config_component_$MODEL.xml + case_last env_case.xml file containing all component specific driver configuration variables (for documentation only - DO NOT EDIT) diff --git a/config/cesm/machines/config_machines.xml b/config/cesm/machines/config_machines.xml index ffa32912b89..b53e91622e3 100644 --- a/config/cesm/machines/config_machines.xml +++ b/config/cesm/machines/config_machines.xml @@ -897,6 +897,7 @@ 64M + /home/fischer/ESMF_code/ESMF_7_1_0_beta/lib/libg/Linux.intel.64.mvapich2.default/esmf.mk diff --git a/scripts/create_newcase b/scripts/create_newcase index 1cacc7833ac..78a4951c0e0 100755 --- a/scripts/create_newcase +++ b/scripts/create_newcase @@ -38,6 +38,10 @@ OR help="(required) Specify a model grid resolution. " "To see list of current compsets, use the utility query_config in this directory") + parser.add_argument("--driver", "-driver", default="mct", choices=('mct','nuopc'), + help="Specify the cime driver " + "Allowed values are ('mct','nuopc') ") + parser.add_argument("--machine", "-mach", help="Specify a machine. default: match NODENAME_REGEX in config_machines.xml " "To see list of current machines, use the utility query_config in this directory" @@ -154,12 +158,17 @@ OR if args.input_dir is not None: args.input_dir = os.path.abspath(args.input_dir) + if args.driver == 'mct': + args.driver = 'drv' + if args.driver == 'nuopc': + args.driver = 'drv-nuopc' + return args.case, args.compset, args.res, args.machine, args.compiler,\ args.mpilib, args.project, args.pecount, \ args.user_mods_dir, args.user_compset, args.pesfile, \ args.user_grid, args.gridfile, args.srcroot, args.test, args.ninst, \ args.walltime, args.queue, args.output_root, args.script_root, \ - run_unsupported, args.answer, args.input_dir + run_unsupported, args.answer, args.input_dir, args.driver ############################################################################### def _main_func(description): @@ -171,7 +180,7 @@ def _main_func(description): user_mods_dir, user_compset, pesfile, \ user_grid, gridfile, srcroot, test, ninst, walltime, queue, \ output_root, script_root, run_unsupported, \ - answer, input_dir = parse_command_line(sys.argv, cimeroot, description) + answer, input_dir, driver = parse_command_line(sys.argv, cimeroot, description) if script_root is None: caseroot = os.path.abspath(casename) @@ -196,7 +205,7 @@ def _main_func(description): user_grid=user_grid, gridfile=gridfile, ninst=ninst, test=test, walltime=walltime, queue=queue, output_root=output_root, run_unsupported=run_unsupported, answer=answer, - input_dir=input_dir) + input_dir=input_dir, driver=driver) case.create_caseroot() diff --git a/scripts/create_test b/scripts/create_test index a5c5130e7e5..5e082cc8ed5 100755 --- a/scripts/create_test +++ b/scripts/create_test @@ -128,6 +128,10 @@ OR "The default is the first listing in MPILIBS in config_machines.xml") if model == "cesm": + parser.add_argument("--driver", "-driver", default="mct", choices=('mct','nuopc'), + help="Specify the cime driver " + "Allowed values are ('mct','nuopc') ") + parser.add_argument("-c", "--compare", help="While testing, compare baselines" " against the given compare directory ") @@ -353,11 +357,17 @@ OR if args.input_dir is not None: args.input_dir = os.path.abspath(args.input_dir) + if args.driver == 'mct': + args.driver = 'drv' + if args.driver == 'nuopc': + args.driver = 'drv-nuopc' + return test_names, test_extra_data, args.compiler, mach_obj.get_machine_name(), args.no_run, args.no_build, args.no_setup, args.no_batch,\ args.test_root, args.baseline_root, args.clean, baseline_cmp_name, baseline_gen_name, \ args.namelists_only, args.project, args.test_id, args.parallel_jobs, args.walltime, \ args.single_submit, args.proc_pool, args.use_existing, args.save_timing, args.queue, \ - args.allow_baseline_overwrite, args.output_root, args.wait, args.force_procs, args.force_threads, args.mpilib, args.input_dir + args.allow_baseline_overwrite, args.output_root, args.wait, args.force_procs, args.force_threads, args.mpilib, args.input_dir, \ + args.driver ############################################################################### def single_submit_impl(machine_name, test_id, proc_pool, project, args, job_cost_map, wall_time, test_root): @@ -463,7 +473,7 @@ def single_submit_impl(machine_name, test_id, proc_pool, project, args, job_cost def create_test(test_names, test_data, compiler, machine_name, no_run, no_build, no_setup, no_batch, test_root, baseline_root, clean, baseline_cmp_name, baseline_gen_name, namelists_only, project, test_id, parallel_jobs, walltime, single_submit, proc_pool, use_existing, save_timing, queue, allow_baseline_overwrite, output_root, wait, - force_procs, force_threads, mpilib, input_dir): + force_procs, force_threads, mpilib, input_dir, driver): ############################################################################### impl = TestScheduler(test_names, test_data=test_data, no_run=no_run, no_build=no_build, no_setup=no_setup, no_batch=no_batch, @@ -476,7 +486,7 @@ def create_test(test_names, test_data, compiler, machine_name, no_run, no_build, proc_pool=proc_pool, use_existing=use_existing, save_timing=save_timing, queue=queue, allow_baseline_overwrite=allow_baseline_overwrite, output_root=output_root, force_procs=force_procs, force_threads=force_threads, - mpilib=mpilib, input_dir=input_dir) + mpilib=mpilib, input_dir=input_dir, driver=driver) success = impl.run_tests(wait=wait) @@ -517,13 +527,14 @@ def _main_func(description): test_names, test_data, compiler, machine_name, no_run, no_build, no_setup, no_batch, \ test_root, baseline_root, clean, baseline_cmp_name, baseline_gen_name, namelists_only, \ project, test_id, parallel_jobs, walltime, single_submit, proc_pool, use_existing, \ - save_timing, queue, allow_baseline_overwrite, output_root, wait, force_procs, force_threads, mpilib, input_dir \ + save_timing, queue, allow_baseline_overwrite, output_root, wait, force_procs, force_threads, mpilib, input_dir, driver \ = parse_command_line(sys.argv, description) sys.exit(create_test(test_names, test_data, compiler, machine_name, no_run, no_build, no_setup, no_batch, test_root, baseline_root, clean, baseline_cmp_name, baseline_gen_name, namelists_only, project, test_id, parallel_jobs, walltime, single_submit, proc_pool, use_existing, save_timing, - queue, allow_baseline_overwrite, output_root, wait, force_procs, force_threads, mpilib, input_dir)) + queue, allow_baseline_overwrite, output_root, wait, force_procs, force_threads, mpilib, input_dir, + driver)) ############################################################################### diff --git a/scripts/lib/CIME/XML/namelist_definition.py b/scripts/lib/CIME/XML/namelist_definition.py index 6a8a631015c..0db930a96a5 100644 --- a/scripts/lib/CIME/XML/namelist_definition.py +++ b/scripts/lib/CIME/XML/namelist_definition.py @@ -49,9 +49,9 @@ def __init__(self, infile, files=None): expect(os.path.isfile(infile), "File {} does not exist".format(infile)) super(NamelistDefinition, self).__init__(infile, schema=schema) - self._attributes = {} self._entry_nodes = [] self._entry_ids = [] + self._attributes = {} self._valid_values = {} self._entry_types = {} self._group_names = {} @@ -158,7 +158,9 @@ def get_value_match(self, vid, attributes=None, exact_match=True, entry_node=Non if entry_node is None: entry_node = self._nodes[vid] - value = super(NamelistDefinition, self).get_value_match(vid.lower(),attributes=all_attributes, exact_match=exact_match, + # value = super(NamelistDefinition, self).get_value_match(vid.lower(),attributes=all_attributes, exact_match=exact_match, + # entry_node=entry_node) + value = super(NamelistDefinition, self).get_value_match(vid,attributes=all_attributes, exact_match=exact_match, entry_node=entry_node) if value is None: value = '' @@ -260,7 +262,7 @@ def is_valid_value(self, name, value): appear in the namelist (even for scalar variables, in which case the length of the list is always 1). """ - name = name.lower() + #name = name.lower() # Separate into a type, optional length, and optional size. type_, max_len, size = self.split_type_string(name) invalid = [] @@ -372,7 +374,8 @@ def dict_to_namelist(self, dict_, filename=None): variable_template = "Variable {!r} from file " + repr(str(filename)) groups = {} for variable_name in dict_: - variable_lc = variable_name.lower() + #variable_lc = variable_name.lower() + variable_lc = variable_name qualified_varname = get_fortran_name_only(variable_lc) self._expect_variable_in_definition(qualified_varname, variable_template) group_name = self.get_group(qualified_varname) @@ -405,5 +408,6 @@ def get_default_value(self, item, attribute=None): if attribute is not None: all_attributes.update(attribute) - value = self.get_value_match(item.lower(), all_attributes, True) + #value = self.get_value_match(item.lower(), all_attributes, True) + value = self.get_value_match(item, all_attributes, True) return self._split_defaults_text(value) diff --git a/scripts/lib/CIME/build.py b/scripts/lib/CIME/build.py index 5917be4504c..861748cb300 100644 --- a/scripts/lib/CIME/build.py +++ b/scripts/lib/CIME/build.py @@ -12,7 +12,7 @@ ############################################################################### def _build_model(build_threaded, exeroot, clm_config_opts, incroot, complist, - lid, caseroot, cimeroot, compiler): + lid, caseroot, cimeroot, compiler, comp_interface): ############################################################################### logs = [] @@ -88,7 +88,8 @@ def _build_model(build_threaded, exeroot, clm_config_opts, incroot, complist, cime_model = get_model() file_build = os.path.join(exeroot, "{}.bldlog.{}".format(cime_model, lid)) - config_dir = os.path.join(cimeroot, "src", "drivers", "mct", "cime_config") + config_dir = os.path.join(cimeroot, "src", "drivers", comp_interface.lower(), "cime_config") + f = open(file_build, "w") bldroot = os.path.join(exeroot, "cpl", "obj") if not os.path.isdir(bldroot): @@ -98,6 +99,8 @@ def _build_model(build_threaded, exeroot, clm_config_opts, incroot, complist, .format(config_dir, caseroot, libroot, bldroot), from_dir=bldroot, verbose=False, arg_stdout=f, arg_stderr=subprocess.STDOUT)[0] + print "DEBUG: config_dir is ",config_dir + f.close() analyze_build_log("{} exe".format(cime_model), file_build, compiler) expect(stat == 0, "BUILD FAIL: buildexe failed, cat {}".format(file_build)) @@ -512,10 +515,12 @@ def _case_build_impl(caseroot, case, sharedlib_only, model_only): logs = _build_libraries(case, exeroot, sharedpath, caseroot, cimeroot, libroot, lid, compiler) + comp_interface = case.get_value("COMP_INTERFACE") + if not sharedlib_only: os.environ["INSTALL_SHAREDPATH"] = os.path.join(exeroot, sharedpath) # for MPAS makefile generators logs.extend(_build_model(build_threaded, exeroot, clm_config_opts, incroot, complist, - lid, caseroot, cimeroot, compiler)) + lid, caseroot, cimeroot, compiler, comp_interface)) if not sharedlib_only: # in case component build scripts updated the xml files, update the case object diff --git a/scripts/lib/CIME/case.py b/scripts/lib/CIME/case.py index bbfbfa9b3b6..760eecd6238 100644 --- a/scripts/lib/CIME/case.py +++ b/scripts/lib/CIME/case.py @@ -89,6 +89,7 @@ def __init__(self, case_root=None, read_only=True): self.set_lookup_value('CIMEROOT',os.path.abspath(get_cime_root())) self._cime_model = get_model() self.set_lookup_value('MODEL', self._cime_model) + self._driver = None self._compsetname = None self._gridname = None self._compsetsfile = None @@ -410,7 +411,7 @@ def clean_up_lookups(self, allow_undefined=False): if result is not None: del self.lookups[key] - def _set_compset_and_pesfile(self, compset_name, files, user_compset=False, pesfile=None): + def _set_compset_and_pesfile(self, compset_name, files, user_compset=False, pesfile=None, driver=None): """ Loop through all the compset files and find the compset specifation file that matches either the input 'compset_name'. @@ -426,10 +427,18 @@ def _set_compset_and_pesfile(self, compset_name, files, user_compset=False, pesf if pesfile is not None: self._pesfile = pesfile + self._driver = driver + # Loop through all of the files listed in COMPSETS_SPEC_FILE and find the file # that has a match for either the alias or the longname in that order for component in components: + # Pick only continue for the correct driver/component combination + if driver == 'drv' and component == 'driver-nuopc': + continue + if driver == 'drv-nuopc' and component == 'drv': + continue + # Determine the compsets file for this component compsets_filename = files.get_value("COMPSETS_SPEC_FILE", {"component":component}) @@ -517,11 +526,10 @@ def _find_primary_component(self): primary_component = spec["GLC"] else: # This is "A", "X" or "S" - primary_component = "drv" + primary_component = self._driver return primary_component - def get_compset_components(self): #If are doing a create_clone then, self._compsetname is not set yet components = [] @@ -569,12 +577,14 @@ def _get_component_config_data(self, files): for env_file in self._env_entryid_files: env_file.add_elements_by_group(files, attlist) - drv_config_file = files.get_value("CONFIG_CPL_FILE") + drv_config_file = files.get_value("CONFIG_CPL_FILE", {"component":self._driver}) + self.set_value("CONFIG_CPL_FILE", drv_config_file) drv_comp = Component(drv_config_file) for env_file in self._env_entryid_files: env_file.add_elements_by_group(drv_comp, attributes=attlist) - drv_config_file_model_specific = files.get_value("CONFIG_CPL_FILE_MODEL_SPECIFIC") + drv_config_file_model_specific = files.get_value("CONFIG_CPL_FILE_MODEL_SPECIFIC", {"component":self._driver}) + self.set_value("CONFIG_CPL_FILE_MODEL_SPECIFIC", drv_config_file_model_specific) drv_comp_model_specific = Component(drv_config_file_model_specific) for env_file in self._env_entryid_files: env_file.add_elements_by_group(drv_comp_model_specific, attributes=attlist) @@ -587,7 +597,6 @@ def _get_component_config_data(self, files): if len(self._component_classes) > len(self._components): self._components.append('sesp') - for i in xrange(1,len(self._component_classes)): comp_class = self._component_classes[i] comp_name = self._components[i-1] @@ -726,13 +735,14 @@ def configure(self, compset_name, grid_name, machine_name=None, user_compset=False, pesfile=None, user_grid=False, gridfile=None, ninst=1, test=False, walltime=None, queue=None, output_root=None, run_unsupported=False, answer=None, - input_dir=None): + input_dir=None, driver=None): #-------------------------------------------- # compset, pesfile, and compset components #-------------------------------------------- files = Files() - compset_alias, science_support = self._set_compset_and_pesfile(compset_name, files, user_compset=user_compset, pesfile=pesfile) + compset_alias, science_support = self._set_compset_and_pesfile(compset_name, files, user_compset=user_compset, pesfile=pesfile, + driver=driver) self._components = self.get_compset_components() #-------------------------------------------- @@ -985,10 +995,6 @@ def _create_caseroot_tools(self): else: shutil.copy(os.path.join(machines_dir, "syslog.noop"), os.path.join(casetools, "mach_syslog")) - # copy cesm.runconfig file into caseroot for NUOPC - driverconfigdir = os.path.join(self.get_value("CIMEROOT"),"src","drivers","mct","cime_config") - shutil.copy(os.path.join(driverconfigdir,"cesm.runconfig"), os.path.join(self._caseroot, "cesm.runconfig")) - def _create_caseroot_sourcemods(self): components = self.get_compset_components() for component in components: diff --git a/scripts/lib/CIME/namelist.py b/scripts/lib/CIME/namelist.py index 70b73f9f245..e3a8d94d86a 100644 --- a/scripts/lib/CIME/namelist.py +++ b/scripts/lib/CIME/namelist.py @@ -114,7 +114,7 @@ # Fortran syntax regular expressions. # Variable names. #FORTRAN_NAME_REGEX = re.compile(r"(^[a-z][a-z0-9_]{0,62})(\([+-]?\d*:?[+-]?\d*:?[+-]?\d*\))?$", re.IGNORECASE) -FORTRAN_NAME_REGEX = re.compile(r"""(^[a-z][a-z0-9_]{0,62}) # The variable name +FORTRAN_NAME_REGEX = re.compile(r"""(^[a-z][a-z0-9_@]{0,62}) # The variable name (\( # begin optional index expression (([+-]?\d+) # Single valued index | # or @@ -883,7 +883,8 @@ def __init__(self, groups=None): if groups is not None: for group_name in groups: expect(group_name is not None, " Got None in groups {}".format(groups)) - group_lc = group_name.lower() + #group_lc = group_name.lower() + group_lc = group_name self._groups[group_lc] = collections.OrderedDict() for variable_name in groups[group_name]: variable_lc = variable_name.lower() @@ -920,7 +921,7 @@ def get_variable_names(self, group_name): >>> sorted(x.get_variable_names('fOo')) [u'bar(::)', u'bazz', u'bazz(2)', u'bazz(:2:)'] """ - group_name = group_name.lower() + #group_name = group_name.lower() if group_name not in self._groups: return [] return self._groups[group_name].keys() @@ -939,8 +940,8 @@ def get_variable_value(self, group_name, variable_name): >>> parse(text='&foo bar=1,2 /').get_variable_value('foO', 'Bar') [u'1', u'2'] """ - group_name = group_name.lower() - variable_name = variable_name.lower() + #group_name = group_name.lower() + #variable_name = variable_name.lower() if group_name not in self._groups or \ variable_name not in self._groups[group_name]: return [u''] @@ -965,7 +966,7 @@ def get_value(self, variable_name): >>> parse(text='&foo / &bazz /').get_value('bar') [u''] """ - variable_name = variable_name.lower() + #variable_name = variable_name.lower() possible_groups = [group_name for group_name in self._groups if variable_name in self._groups[group_name]] expect(len(possible_groups) <= 1, @@ -1001,10 +1002,11 @@ def set_variable_value(self, group_name, variable_name, value, var_size=1): >>> x.get_variable_value('foo', 'red') ['', u'2', '', u'4', '', u'6'] """ - group_name = group_name.lower() + #group_name = group_name.lower() minindex, maxindex, step = get_fortran_variable_indices(variable_name, var_size) - variable_name = get_fortran_name_only(variable_name.lower()) + #variable_name = get_fortran_name_only(variable_name.lower()) + variable_name = get_fortran_name_only(variable_name) expect(minindex > 0, "Indices < 1 not supported in CIME interface to fortran namelists... lower bound={}".format(minindex)) @@ -1042,8 +1044,8 @@ def delete_variable(self, group_name, variable_name): >>> x.get_variable_names('brack') [] """ - group_name = group_name.lower() - variable_name = variable_name.lower() + #group_name = group_name.lower() + #variable_name = variable_name.lower() if group_name in self._groups and \ variable_name in self._groups[group_name]: del self._groups[group_name][variable_name] @@ -1109,7 +1111,9 @@ def merge_nl(self, other, overwrite=False): self.set_variable_value(group_name, variable_name, merged_val, var_size=len(merged_val)) - def write(self, out_file, groups=None, append=False, format_='nml', sorted_groups=True): + def write(self, out_file, groups=None, append=False, format_='nml', sorted_groups=True, + skip_comps=None, prognostic_comps=None, atm_cpl_dt=None, ocn_cpl_dt=None): + """Write a Fortran namelist to a file. As with `parse`, the `out_file` argument can be either a file name, or a @@ -1124,32 +1128,132 @@ def write(self, out_file, groups=None, append=False, format_='nml', sorted_group specifies the file format. Formats other than 'nml' may not support all possible output values. """ - expect(format_ in ('nml', 'rc', 'nmlcontents'), + expect(format_ in ('nml', 'rc', 'nmlcontents', 'nuopc'), "Namelist.write: unexpected output format {!r}".format(str(format_))) if isinstance(out_file, str) or isinstance(out_file, unicode): logger.debug("Writing namelist to: {}".format(out_file)) flag = 'a' if append else 'w' with open(out_file, flag) as file_obj: - self._write(file_obj, groups, format_, sorted_groups=sorted_groups) + if format_ == 'nuopc': + self._write_nuopc(file_obj, groups, sorted_groups=sorted_groups, + skip_comps=skip_comps, atm_cpl_dt=atm_cpl_dt, ocn_cpl_dt=ocn_cpl_dt) + else: + self._write(file_obj, groups, format_, sorted_groups=sorted_groups) else: logger.debug("Writing namelist to file object") - self._write(out_file, groups, format_, sorted_groups=sorted_groups) + if format_ == 'nuopc': + self._write_noupc(out_file, groups, sorted_groups=sorted_groups, + skip_comps=skip_comps, atm_cpl_dt=atm_cpl_dt, ocn_cpl_dt=ocn_cpl_dt) + else: + self._write(out_file, groups, format_, sorted_groups=sorted_groups) + + def _write_nuopc(self, out_file, groups, sorted_groups, skip_comps, atm_cpl_dt, ocn_cpl_dt): + """Unwrapped version of `write` assuming that a file object is input.""" + + if groups is None: + groups = self._groups.keys() + + if (sorted_groups): + #group_names = sorted(group.lower() for group in groups) + group_names = sorted(group for group in groups) + else: + group_names = groups + + for group_name in group_names: + if "_attributes" not in group_name and "nuopc_" not in group_name: + continue + + if "_attributes" in group_name: + out_file.write("{}::\n".format(group_name)) + + group = self._groups[group_name] + for name in sorted(group.keys()): + values = group[name] + if "component_list" in name: + for skip_comp in skip_comps: + if skip_comp in values[0]: + values[0] = values[0].replace(skip_comp,"") + components = values[0] + + # @ is used in a namelist to put the same namelist variable in multiple groups + # in the write phase, all characters in the namelist variable name after + # the @ and including the @ should be removed + if "@" in name: + name = re.sub('@.+$', "", name) + + equals = " =" + if group_name == 'nuopc_runseq': + equals = '::\n ' + elif "_var" in group_name: + equals = ':' + # To prettify things for long lists of values, build strings + # line-by-line. + if values[0] == "True" or values[0] == "False": + values[0] = values[0].replace("True",".true.").replace("False",".false.") + + if "_attribute" in group_name: + lines = [" {}{} {}".format(name, equals, values[0])] + else: + lines = ["{}{} {}".format(name, equals, values[0])] + + for value in values[1:]: + if value == "True" or value == "False": + value = value.replace("True",".true.").replace("False",".false.") + if len(lines[-1]) + len(value) <= 77: + lines[-1] += ", " + value + else: + lines[-1] += ",\n" + lines.append(" " + value) + lines[-1] += "\n" + for line in lines: + line = line.replace('"','') + # remove un-needed entries from the nuopc_runseq based + # on the prognostic_comps and skip_comps lists + if group_name == 'nuopc_runseq': + run_entries = line.splitlines() + newline = "" + for run_entry in run_entries: + print_entry = True + for skip_comp in skip_comps: + if skip_comp in run_entry: + print_entry = False + logger.info("Writing nuopc_runseq, skipping {}".format(run_entry)) + if skip_comp.lower().strip() in run_entry: + print_entry = False + logger.info("Writing nuopc_runseq, skipping {}".format(run_entry)) + if print_entry: + if "@atm_cpl_dt" in run_entry: + run_entry = run_entry.replace("atm_cpl_dt",atm_cpl_dt) + if "@ocn_cpl_dt" in run_entry: + run_entry = run_entry.replace("ocn_cpl_dt",ocn_cpl_dt) + newline += run_entry + "\n" + out_file.write(newline) + else: + out_file.write(line) + + if "_attribute" in group_name or "runseq" in group_name: + out_file.write("::\n\n") + def _write(self, out_file, groups, format_, sorted_groups): """Unwrapped version of `write` assuming that a file object is input.""" if groups is None: groups = self._groups.keys() + if format_ == 'nml' or format_ == 'nmlcontents': equals = ' =' elif format_ == 'rc': equals = ':' + if (sorted_groups): group_names = sorted(group.lower() for group in groups) else: group_names = groups + for group_name in group_names: if format_ == 'nml': out_file.write("&{}\n".format(group_name)) + group = self._groups[group_name] for name in sorted(group.keys()): values = group[name] @@ -1164,6 +1268,7 @@ def _write(self, out_file, groups, format_, sorted_groups): # line-by-line. if values[0] == "True" or values[0] == "False": values[0] = values[0].replace("True",".true.").replace("False",".false.") + lines = [" {}{} {}".format(name, equals, values[0])] for value in values[1:]: if value == "True" or value == "False": @@ -1181,7 +1286,6 @@ def _write(self, out_file, groups, format_, sorted_groups): if format_ == 'nmlcontents': out_file.write("\n") - class _NamelistEOF(Exception): """Exception thrown for an unexpected end-of-file in a namelist. diff --git a/scripts/lib/CIME/nmlgen.py b/scripts/lib/CIME/nmlgen.py index 1d0786c9b1f..4942e9a9a97 100644 --- a/scripts/lib/CIME/nmlgen.py +++ b/scripts/lib/CIME/nmlgen.py @@ -656,3 +656,14 @@ def write_seq_maps(self, filename): def write_modelio_file(self, filename): """ Write component modelio files""" self._namelist.write(filename, groups=["modelio", "pio_inparm"], format_="nml") + + def write_nuopc_config_file(self, filename, data_list_path=None, + skip_comps=None, atm_cpl_dt=None, ocn_cpl_dt=None): + self._definition.validate(self._namelist) + groups = self._namelist.get_group_names() + self._namelist.write(filename, groups=groups, format_='nuopc', sorted_groups=False, + skip_comps=skip_comps, atm_cpl_dt=atm_cpl_dt, ocn_cpl_dt=ocn_cpl_dt) + if data_list_path is not None: + # append to input_data_list file + with open(data_list_path, "a") as input_data_list: + self._write_input_files(input_data_list) diff --git a/scripts/lib/CIME/test_scheduler.py b/scripts/lib/CIME/test_scheduler.py index 908b2ce6e80..378e196eea6 100644 --- a/scripts/lib/CIME/test_scheduler.py +++ b/scripts/lib/CIME/test_scheduler.py @@ -86,7 +86,7 @@ def __init__(self, test_names, test_data=None, walltime=None, proc_pool=None, use_existing=False, save_timing=False, queue=None, allow_baseline_overwrite=False, output_root=None, - force_procs=None, force_threads=None, mpilib=None, input_dir=None): + force_procs=None, force_threads=None, mpilib=None, input_dir=None, driver=None): ########################################################################### self._cime_root = CIME.utils.get_cime_root() self._cime_model = get_model() @@ -96,6 +96,7 @@ def __init__(self, test_names, test_data=None, self._mpilib = mpilib # allow override of default mpilib self._completed_tests = 0 self._input_dir = input_dir + self._driver = driver self._allow_baseline_overwrite = allow_baseline_overwrite @@ -364,6 +365,8 @@ def _create_newcase_phase(self, test): create_newcase_cmd += " --output-root {} ".format(self._output_root) if self._input_dir is not None: create_newcase_cmd += " --input-dir {} ".format(self._input_dir) + if self._driver == 'drv-nuopc': + create_newcase_cmd += " --driver nuopc " if test_mods is not None: files = Files() @@ -484,15 +487,7 @@ def _xml_phase(self, test): elif opt == 'E': envtest.set_test_parameter("USE_ESMF_LIB", "TRUE") -# envtest.set_test_parameter("COMP_INTERFACE", "ESMF") logger.debug (" USE_ESMF_LIB set to TRUE") -# logger.debug (" COMP_INTERFACE set to ESMF") - - elif opt == 'EN': - envtest.set_test_parameter("USE_ESMF_LIB", "TRUE") - envtest.set_test_parameter("COMP_INTERFACE", "NUOPC") - logger.debug (" USE_ESMF_LIB set to TRUE") - logger.debug (" COMP_INTERFACE set to NUOPC") elif opt == 'CG': envtest.set_test_parameter("CALENDAR", "GREGORIAN") diff --git a/src/build_scripts/buildlib.csm_share b/src/build_scripts/buildlib.csm_share index 1ab27504acb..2921026f315 100755 --- a/src/build_scripts/buildlib.csm_share +++ b/src/build_scripts/buildlib.csm_share @@ -29,12 +29,12 @@ my $NINST_WAV = `./xmlquery NINST_WAV -value`; my $NINST_ESP = `./xmlquery NINST_ESP -value`; my $NINST_VALUE = `./xmlquery NINST_VALUE -value`; $ENV{PIO_VERSION} = `./xmlquery PIO_VERSION -value`; + #-------------------------------------------------------------------- # Filepath: list of source code directories (in order of importance). #-------------------------------------------------------------------- my $comp="mct"; -$comp = "esmf" if ($COMP_INTERFACE eq "ESMF"); $comp = "nuopc" if ($COMP_INTERFACE eq "NUOPC"); my $useesmf = "noesmf"; @@ -45,20 +45,22 @@ my $installdir = "$installroot/${COMP_INTERFACE}/$useesmf/${NINST_VALUE}"; mkpath($libdir) unless -d $libdir; chdir($libdir) or die "Could not cd to $libdir: $!\n"; -my @filepath = ( "$CASEROOT/SourceMods/src.share", - "$CIMEROOT/src/drivers/mct/shr", - "$CIMEROOT/src/components/xcpl_models/xshare", - "$CIMEROOT/src/share/util", - "$CIMEROOT/src/share/RandNum/src", - "$CIMEROOT/src/share/RandNum/src/dsfmt_f03", - "$CIMEROOT/src/share/RandNum/src/kissvec", - "$CIMEROOT/src/share/RandNum/src/mt19937", - ); - -if($comp eq "nuopc"){ +my @filepath = ("$CASEROOT/SourceMods/src.share"); + +if($comp eq "nuopc") { push(@filepath,"$CIMEROOT/src/drivers/nuopc/shr"); } +my @filepath_add = ("$CIMEROOT/src/drivers/mct/shr", + "$CIMEROOT/src/components/xcpl_models/xshare", + "$CIMEROOT/src/share/util", + "$CIMEROOT/src/share/RandNum/src", + "$CIMEROOT/src/share/RandNum/src/dsfmt_f03", + "$CIMEROOT/src/share/RandNum/src/kissvec", + "$CIMEROOT/src/share/RandNum/src/mt19937"); + +push (@filepath, @filepath_add); + if($useesmf eq "noesmf"){ push(@filepath,"$CIMEROOT/src/share/esmf_wrf_timemgr"); } diff --git a/src/components/data_comps/datm/datm_comp_nuopc.F90 b/src/components/data_comps/datm/datm_comp_nuopc.F90 index 4585f98542e..cbc68bc1c24 100644 --- a/src/components/data_comps/datm/datm_comp_nuopc.F90 +++ b/src/components/data_comps/datm/datm_comp_nuopc.F90 @@ -13,16 +13,17 @@ module datm_comp_nuopc use shr_sys_mod ! shared system calls use seq_flds_mod - use seq_cdata_mod, only: seq_cdata - use seq_infodata_mod, only: seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData + use seq_cdata_mod , only: seq_cdata + use seq_infodata_mod , only: seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData use shr_nuopc_fldList_mod - use shr_nuopc_methods_mod, only: shr_nuopc_methods_Clock_TimePrint - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_gridinit - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_AttrCopyToInfodata - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_AvectToState - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_StateToAvect - use shr_file_mod, only : shr_file_getlogunit, shr_file_setlogunit, & - shr_file_getloglevel, shr_file_setloglevel + use shr_nuopc_methods_mod , only: shr_nuopc_methods_Clock_TimePrint + use shr_nuopc_methods_mod , only: shr_nuopc_methods_ChkErr + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_gridinit + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_AttrCopyToInfodata + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_AvectToState + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_StateToAvect + use shr_file_mod , only: shr_file_getlogunit, shr_file_setlogunit + use shr_file_mod , only: shr_file_getloglevel, shr_file_setloglevel use ESMF use NUOPC @@ -48,17 +49,18 @@ module datm_comp_nuopc type (shr_nuopc_fldList_Type) :: fldsToAtm type (shr_nuopc_fldList_Type) :: fldsFrAtm - type(seq_cdata) :: cdata + type(seq_cdata) :: cdata type(seq_infodata_type),target :: infodata type(mct_gsMap) ,target :: gsmap type(mct_gGrid) ,target :: ggrid - type(mct_aVect) :: x2d - type(mct_aVect) :: d2x - integer :: mpicom, iam - integer :: dbrc - character(len=1024) :: tmpstr - character(len=*),parameter :: grid_option = "mesh" ! grid_de, grid_arb, grid_reg, mesh - integer, parameter :: dbug = 10 + type(mct_aVect) :: x2d + type(mct_aVect) :: d2x + integer :: mpicom, iam + integer :: dbrc + character(len=1024) :: tmpstr + character(len=*),parameter :: grid_option = "mesh" ! grid_de, grid_arb, grid_reg, mesh + integer, parameter :: dbug = 10 + logical :: unpack_import !----- formats ----- character(*),parameter :: modName = "(datm_comp_nuopc)" @@ -257,7 +259,10 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) real(r8) :: nextsw_cday integer :: shrlogunit, shrloglev type(ESMF_VM) :: vm + logical :: connected + integer :: n character(len=*),parameter :: subname=trim(modName)//':(InitializeRealize) ' + logical :: first_time = .true. rc = ESMF_SUCCESS if (dbug > 5) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO, rc=dbrc) @@ -290,13 +295,22 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) phase = 1 if (phase == 1) then + ! Note - must query NUOPC_IsConnected before the NUOPC_Realize call below + unpack_import = .false. + do n = 1,fldsToAtm%num + connected = NUOPC_IsConnected(importState, fieldName=fldsToAtm%shortname(n)) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort() + if (connected) unpack_import = .true. + end do + if (.not. unpack_import) then + call ESMF_LogWrite(trim(subname)//": will not unpack import state ", ESMF_LOGMSG_INFO, rc=dbrc) + end if + !-------------------------------- ! setup cdata for use inside data model ! initialize cleanly on data model side ! don't use seq_cdata_init as it grabs stuff from seq_comm !-------------------------------- -! call seq_cdata_init(cdata,MCTID,ggrid,gsmap,infodata,'datm') -! call seq_cdata_setptrs(cdata,mpicom=mpicom) cdata%name = 'datm' cdata%ID = MCTID cdata%mpicom = mpicom @@ -525,11 +539,13 @@ subroutine ModelAdvance(gcomp, rc) endif !-------------------------------- - ! Unpack export state + ! Unpack import state !-------------------------------- - call shr_nuopc_dmodel_StateToAvect(importState, x2d, grid_option, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return ! bail out + if (unpack_import) then + call shr_nuopc_dmodel_StateToAvect(importState, x2d, grid_option, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return ! bail out + end if !-------------------------------- ! Run model diff --git a/src/components/data_comps/dice/dice_comp_nuopc.F90 b/src/components/data_comps/dice/dice_comp_nuopc.F90 index 7bcf68bb8ee..feb48a7de23 100644 --- a/src/components/data_comps/dice/dice_comp_nuopc.F90 +++ b/src/components/data_comps/dice/dice_comp_nuopc.F90 @@ -13,16 +13,17 @@ module dice_comp_nuopc use shr_sys_mod ! shared system calls use seq_flds_mod - use seq_cdata_mod, only: seq_cdata - use seq_infodata_mod, only: seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData + use seq_cdata_mod , only: seq_cdata + use seq_infodata_mod , only: seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData use shr_nuopc_fldList_mod - use shr_nuopc_methods_mod, only: shr_nuopc_methods_Clock_TimePrint - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_gridinit - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_AttrCopyToInfodata - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_AvectToState - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_StateToAvect - use shr_file_mod, only : shr_file_getlogunit, shr_file_setlogunit, & - shr_file_getloglevel, shr_file_setloglevel + use shr_nuopc_methods_mod , only: shr_nuopc_methods_Clock_TimePrint + use shr_nuopc_methods_mod , only: shr_nuopc_methods_ChkErr + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_gridinit + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_AttrCopyToInfodata + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_AvectToState + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_StateToAvect + use shr_file_mod , only: shr_file_getlogunit, shr_file_setlogunit + use shr_file_mod , only: shr_file_getloglevel, shr_file_setloglevel use ESMF use NUOPC @@ -48,17 +49,18 @@ module dice_comp_nuopc type (shr_nuopc_fldList_Type) :: fldsToIce type (shr_nuopc_fldList_Type) :: fldsFrIce - type(seq_cdata) :: cdata + type(seq_cdata) :: cdata type(seq_infodata_type),target :: infodata type(mct_gsMap) ,target :: gsmap type(mct_gGrid) ,target :: ggrid - type(mct_aVect) :: x2d - type(mct_aVect) :: d2x - integer :: mpicom, iam - integer :: dbrc - character(len=1024) :: tmpstr - character(len=*),parameter :: grid_option = "mesh" ! grid_de, grid_arb, grid_reg, mesh - integer, parameter :: dbug = 10 + type(mct_aVect) :: x2d + type(mct_aVect) :: d2x + integer :: mpicom, iam + integer :: dbrc + character(len=1024) :: tmpstr + character(len=*),parameter :: grid_option = "mesh" ! grid_de, grid_arb, grid_reg, mesh + integer, parameter :: dbug = 10 + logical :: unpack_import !----- formats ----- character(*),parameter :: modName = "(dice_comp_nuopc)" @@ -257,6 +259,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) real(r8) :: nextsw_cday integer :: shrlogunit, shrloglev type(ESMF_VM) :: vm + logical :: connected + integer :: n character(len=*),parameter :: subname=trim(modName)//':(InitializeRealize) ' rc = ESMF_SUCCESS @@ -290,13 +294,21 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) phase = 1 if (phase == 1) then + unpack_import = .false. + do n = 1,fldsToIce%num + connected = NUOPC_IsConnected(importState, fieldName=fldsToIce%shortname(n)) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort() + if (connected) unpack_import = .true. + end do + if (.not. unpack_import) then + call ESMF_LogWrite(trim(subname)//": will not unpack import state ", ESMF_LOGMSG_INFO, rc=dbrc) + end if + !-------------------------------- ! setup cdata for use inside data model ! initialize cleanly on data model side ! don't use seq_cdata_init as it grabs stuff from seq_comm !-------------------------------- -! call seq_cdata_init(cdata,MCTID,ggrid,gsmap,infodata,'dice') -! call seq_cdata_setptrs(cdata,mpicom=mpicom) cdata%name = 'dice' cdata%ID = MCTID cdata%mpicom = mpicom diff --git a/src/components/data_comps/docn/docn_comp_nuopc.F90 b/src/components/data_comps/docn/docn_comp_nuopc.F90 index 1057130df5e..54636609002 100644 --- a/src/components/data_comps/docn/docn_comp_nuopc.F90 +++ b/src/components/data_comps/docn/docn_comp_nuopc.F90 @@ -13,16 +13,17 @@ module docn_comp_nuopc use shr_sys_mod ! shared system calls use seq_flds_mod - use seq_cdata_mod, only: seq_cdata - use seq_infodata_mod, only: seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData + use seq_cdata_mod , only: seq_cdata + use seq_infodata_mod , only: seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData use shr_nuopc_fldList_mod - use shr_nuopc_methods_mod, only: shr_nuopc_methods_Clock_TimePrint - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_gridinit - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_AttrCopyToInfodata - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_AvectToState - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_StateToAvect - use shr_file_mod, only : shr_file_getlogunit, shr_file_setlogunit, & - shr_file_getloglevel, shr_file_setloglevel + use shr_nuopc_methods_mod , only: shr_nuopc_methods_Clock_TimePrint + use shr_nuopc_methods_mod , only: shr_nuopc_methods_ChkErr + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_gridinit + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_AttrCopyToInfodata + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_AvectToState + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_StateToAvect + use shr_file_mod , only: shr_file_getlogunit, shr_file_setlogunit + use shr_file_mod , only: shr_file_getloglevel, shr_file_setloglevel use ESMF use NUOPC @@ -48,17 +49,18 @@ module docn_comp_nuopc type (shr_nuopc_fldList_Type) :: fldsToOcn type (shr_nuopc_fldList_Type) :: fldsFrOcn - type(seq_cdata) :: cdata + type(seq_cdata) :: cdata type(seq_infodata_type),target :: infodata type(mct_gsMap) ,target :: gsmap type(mct_gGrid) ,target :: ggrid - type(mct_aVect) :: x2d - type(mct_aVect) :: d2x - integer :: mpicom, iam - integer :: dbrc - character(len=1024) :: tmpstr - character(len=*),parameter :: grid_option = "mesh" ! grid_de, grid_arb, grid_reg, mesh - integer, parameter :: dbug = 10 + type(mct_aVect) :: x2d + type(mct_aVect) :: d2x + integer :: mpicom, iam + integer :: dbrc + character(len=1024) :: tmpstr + character(len=*),parameter :: grid_option = "mesh" ! grid_de, grid_arb, grid_reg, mesh + integer, parameter :: dbug = 10 + logical :: unpack_import !----- formats ----- character(*),parameter :: modName = "(docn_comp_nuopc)" @@ -257,6 +259,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) real(r8) :: nextsw_cday integer :: shrlogunit, shrloglev type(ESMF_VM) :: vm + logical :: connected + integer :: n character(len=*),parameter :: subname=trim(modName)//':(InitializeRealize) ' rc = ESMF_SUCCESS @@ -290,13 +294,21 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) phase = 1 if (phase == 1) then + unpack_import = .false. + do n = 1,fldsToOcn%num + connected = NUOPC_IsConnected(importState, fieldName=fldsToOcn%shortname(n)) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort() + if (connected) unpack_import = .true. + end do + if (.not. unpack_import) then + call ESMF_LogWrite(trim(subname)//": will not unpack import state ", ESMF_LOGMSG_INFO, rc=dbrc) + end if + !-------------------------------- ! setup cdata for use inside data model ! initialize cleanly on data model side ! don't use seq_cdata_init as it grabs stuff from seq_comm !-------------------------------- -! call seq_cdata_init(cdata,MCTID,ggrid,gsmap,infodata,'docn') -! call seq_cdata_setptrs(cdata,mpicom=mpicom) cdata%name = 'docn' cdata%ID = MCTID cdata%mpicom = mpicom @@ -522,11 +534,13 @@ subroutine ModelAdvance(gcomp, rc) endif !-------------------------------- - ! Unpack export state + ! Unpack import state !-------------------------------- - call shr_nuopc_dmodel_StateToAvect(importState, x2d, grid_option, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return ! bail out + if (unpack_import) then + call shr_nuopc_dmodel_StateToAvect(importState, x2d, grid_option, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return ! bail out + end if !-------------------------------- ! Run model diff --git a/src/components/data_comps/drof/drof_comp_nuopc.F90 b/src/components/data_comps/drof/drof_comp_nuopc.F90 index d1823d7d030..835286c6292 100644 --- a/src/components/data_comps/drof/drof_comp_nuopc.F90 +++ b/src/components/data_comps/drof/drof_comp_nuopc.F90 @@ -13,16 +13,17 @@ module drof_comp_nuopc use shr_sys_mod ! shared system calls use seq_flds_mod - use seq_cdata_mod, only: seq_cdata - use seq_infodata_mod, only: seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData + use seq_cdata_mod , only: seq_cdata + use seq_infodata_mod , only: seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData use shr_nuopc_fldList_mod - use shr_nuopc_methods_mod, only: shr_nuopc_methods_Clock_TimePrint - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_gridinit - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_AttrCopyToInfodata - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_AvectToState - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_StateToAvect - use shr_file_mod, only : shr_file_getlogunit, shr_file_setlogunit, & - shr_file_getloglevel, shr_file_setloglevel + use shr_nuopc_methods_mod , only: shr_nuopc_methods_Clock_TimePrint + use shr_nuopc_methods_mod , only: shr_nuopc_methods_ChkErr + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_gridinit + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_AttrCopyToInfodata + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_AvectToState + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_StateToAvect + use shr_file_mod , only: shr_file_getlogunit, shr_file_setlogunit + use shr_file_mod , only: shr_file_getloglevel, shr_file_setloglevel use ESMF use NUOPC @@ -48,17 +49,18 @@ module drof_comp_nuopc type (shr_nuopc_fldList_Type) :: fldsToRof type (shr_nuopc_fldList_Type) :: fldsFrRof - type(seq_cdata) :: cdata + type(seq_cdata) :: cdata type(seq_infodata_type),target :: infodata type(mct_gsMap) ,target :: gsmap type(mct_gGrid) ,target :: ggrid - type(mct_aVect) :: x2d - type(mct_aVect) :: d2x - integer :: mpicom, iam - integer :: dbrc - character(len=1024) :: tmpstr - character(len=*),parameter :: grid_option = "mesh" ! grid_de, grid_arb, grid_reg, mesh - integer, parameter :: dbug = 10 + type(mct_aVect) :: x2d + type(mct_aVect) :: d2x + integer :: mpicom, iam + integer :: dbrc + character(len=1024) :: tmpstr + character(len=*),parameter :: grid_option = "mesh" ! grid_de, grid_arb, grid_reg, mesh + integer, parameter :: dbug = 10 + logical :: unpack_import !----- formats ----- character(*),parameter :: modName = "(drof_comp_nuopc)" @@ -257,6 +259,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) real(r8) :: nextsw_cday integer :: shrlogunit, shrloglev type(ESMF_VM) :: vm + logical :: connected + integer :: n character(len=*),parameter :: subname=trim(modName)//':(InitializeRealize) ' rc = ESMF_SUCCESS @@ -290,13 +294,21 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) phase = 1 if (phase == 1) then + unpack_import = .false. + do n = 1,fldsToRof%num + connected = NUOPC_IsConnected(importState, fieldName=fldsToRof%shortname(n)) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort() + if (connected) unpack_import = .true. + end do + if (.not. unpack_import) then + call ESMF_LogWrite(trim(subname)//": will not unpack import state ", ESMF_LOGMSG_INFO, rc=dbrc) + end if + !-------------------------------- ! setup cdata for use inside data model ! initialize cleanly on data model side ! don't use seq_cdata_init as it grabs stuff from seq_comm !-------------------------------- -! call seq_cdata_init(cdata,MCTID,ggrid,gsmap,infodata,'drof') -! call seq_cdata_setptrs(cdata,mpicom=mpicom) cdata%name = 'drof' cdata%ID = MCTID cdata%mpicom = mpicom @@ -488,15 +500,15 @@ subroutine ModelAdvance(gcomp, rc) integer, intent(out) :: rc ! local variables - type(ESMF_Clock) :: clock - type(ESMF_Time) :: time - type(ESMF_State) :: importState, exportState - integer :: CurrentYMD, CurrentTOD, yy, mm, dd, stepno, idt - integer :: shrlogunit, shrloglev - real(r8) :: value - real(r8) :: nextsw_cday - character(len=128) :: calendar - character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' + type(ESMF_Clock) :: clock + type(ESMF_Time) :: time + type(ESMF_State) :: importState, exportState + integer :: CurrentYMD, CurrentTOD, yy, mm, dd, stepno, idt + integer :: shrlogunit, shrloglev + real(r8) :: value + real(r8) :: nextsw_cday + character(len=128) :: calendar + character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' rc = ESMF_SUCCESS if (dbug > 5) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO, rc=dbrc) @@ -522,11 +534,13 @@ subroutine ModelAdvance(gcomp, rc) endif !-------------------------------- - ! Unpack export state + ! Unpack import state !-------------------------------- - call shr_nuopc_dmodel_StateToAvect(importState, x2d, grid_option, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return ! bail out + if (unpack_import) then + call shr_nuopc_dmodel_StateToAvect(importState, x2d, grid_option, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return ! bail out + end if !-------------------------------- ! Run model diff --git a/src/components/data_comps/dwav/dwav_comp_nuopc.F90 b/src/components/data_comps/dwav/dwav_comp_nuopc.F90 index 3784024ccb5..5160fbd1d66 100644 --- a/src/components/data_comps/dwav/dwav_comp_nuopc.F90 +++ b/src/components/data_comps/dwav/dwav_comp_nuopc.F90 @@ -13,16 +13,16 @@ module dwav_comp_nuopc use shr_sys_mod ! shared system calls use seq_flds_mod - use seq_cdata_mod, only: seq_cdata - use seq_infodata_mod, only: seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData + use seq_cdata_mod , only: seq_cdata + use seq_infodata_mod , only: seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData use shr_nuopc_fldList_mod - use shr_nuopc_methods_mod, only: shr_nuopc_methods_Clock_TimePrint - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_gridinit - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_AttrCopyToInfodata - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_AvectToState - use shr_nuopc_dmodel_mod, only: shr_nuopc_dmodel_StateToAvect - use shr_file_mod, only : shr_file_getlogunit, shr_file_setlogunit, & - shr_file_getloglevel, shr_file_setloglevel + use shr_nuopc_methods_mod , only: shr_nuopc_methods_Clock_TimePrint + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_gridinit + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_AttrCopyToInfodata + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_AvectToState + use shr_nuopc_dmodel_mod , only: shr_nuopc_dmodel_StateToAvect + use shr_file_mod , only: shr_file_getlogunit, shr_file_setlogunit + use shr_file_mod , only: shr_file_getloglevel, shr_file_setloglevel use ESMF use NUOPC @@ -45,20 +45,21 @@ module dwav_comp_nuopc private ! except - type (shr_nuopc_fldList_Type) :: fldsToWav - type (shr_nuopc_fldList_Type) :: fldsFrWav + type (shr_nuopc_fldList_Type) :: fldsToWav + type (shr_nuopc_fldList_Type) :: fldsFrWav - type(seq_cdata) :: cdata + type(seq_cdata) :: cdata type(seq_infodata_type),target :: infodata type(mct_gsMap) ,target :: gsmap type(mct_gGrid) ,target :: ggrid - type(mct_aVect) :: x2d - type(mct_aVect) :: d2x - integer :: mpicom, iam - integer :: dbrc - character(len=1024) :: tmpstr - character(len=*),parameter :: grid_option = "mesh" ! grid_de, grid_arb, grid_reg, mesh - integer, parameter :: dbug = 10 + type(mct_aVect) :: x2d + type(mct_aVect) :: d2x + integer :: mpicom, iam + integer :: dbrc + character(len=1024) :: tmpstr + character(len=*),parameter :: grid_option = "mesh" ! grid_de, grid_arb, grid_reg, mesh + integer, parameter :: dbug = 10 + logical :: unpack_import !----- formats ----- character(*),parameter :: modName = "(dwav_comp_nuopc)" @@ -290,13 +291,22 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) phase = 1 if (phase == 1) then + ! Note - must query NUOPC_IsConnected before the NUOPC_Realize call below + unpack_import = .false. + do n = 1,fldsToWav%num + connected = NUOPC_IsConnected(importState, fieldName=fldsToWav%shortname(n)) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort() + if (connected) unpack_import = .true. + end do + if (.not. unpack_import) then + call ESMF_LogWrite(trim(subname)//": will not unpack import state ", ESMF_LOGMSG_INFO, rc=dbrc) + end if + !-------------------------------- ! setup cdata for use inside data model ! initialize cleanly on data model side ! don't use seq_cdata_init as it grabs stuff from seq_comm !-------------------------------- -! call seq_cdata_init(cdata,MCTID,ggrid,gsmap,infodata,'dwav') -! call seq_cdata_setptrs(cdata,mpicom=mpicom) cdata%name = 'dwav' cdata%ID = MCTID cdata%mpicom = mpicom @@ -522,11 +532,13 @@ subroutine ModelAdvance(gcomp, rc) endif !-------------------------------- - ! Unpack export state + ! Unpack import state !-------------------------------- - call shr_nuopc_dmodel_StateToAvect(importState, x2d, grid_option, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return ! bail out + if (unpack_import) then + call shr_nuopc_dmodel_StateToAvect(importState, x2d, grid_option, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return ! bail out + end if !-------------------------------- ! Run model diff --git a/src/drivers/mct/cime_config/buildexe b/src/drivers/mct/cime_config/buildexe index 8d2f9cfea7e..627330611a9 100755 --- a/src/drivers/mct/cime_config/buildexe +++ b/src/drivers/mct/cime_config/buildexe @@ -38,11 +38,8 @@ def _main_func(): with open('Filepath', 'w') as out: - comp_interface = case.get_value("COMP_INTERFACE") out.write(os.path.join(caseroot, "SourceMods", "src.drv") + "\n") out.write(os.path.join(cimeroot, "src", "drivers", "mct", "main") + "\n") - if (comp_interface == "NUOPC"): - out.write(os.path.join(cimeroot, "src", "drivers", "nuopc", "main") + "\n") # build model executable diff --git a/src/drivers/mct/cime_config/buildnml b/src/drivers/mct/cime_config/buildnml index 74ee736cf90..322e558c67f 100755 --- a/src/drivers/mct/cime_config/buildnml +++ b/src/drivers/mct/cime_config/buildnml @@ -182,13 +182,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files): nmlgen.write_seq_maps(seq_maps_file) #-------------------------------- - # (3) Place hold for generation of cesm.runconfig for NUOPC driver - #-------------------------------- -# cesm_run_file = os.path.join(confdir, "cesm.runconfig") -# nmlgen.write_cesm_run(cesm_run_file) - - #-------------------------------- - # (4) Construct and write out drv_flds_in + # (3) Construct and write out drv_flds_in #-------------------------------- # In thte following, all values come simply from the infiles - no default values need to be added # FIXME - do want to add the possibility that will use a user definition file for drv_flds_in @@ -357,7 +351,6 @@ def buildnml(case, caseroot, component): shutil.copy(drv_flds_in, rundir) shutil.copy(os.path.join(confdir,"seq_maps.rc"), rundir) - shutil.copy(os.path.join(caseroot,"cesm.runconfig"), rundir) for filename in glob.glob(os.path.join(confdir, "*modelio*")): shutil.copy(filename, rundir) diff --git a/src/drivers/mct/cime_config/namelist_definition_nuopc.xml b/src/drivers/mct/cime_config/namelist_definition_nuopc.xml new file mode 100644 index 00000000000..db59bf0115c --- /dev/null +++ b/src/drivers/mct/cime_config/namelist_definition_nuopc.xml @@ -0,0 +1,2445 @@ + + + + + + + + char + nuopc + nuopc_components_var + + ATM OCN ICE LND ROF MED + + + + + char + nuopc + DRIVER_attributes + + 0 + + + + + + + char + nuopc + DRIVER_attributes + + 0 + + + + + char + nuopc + nuopc_var + + cesm + + + + + char + nuopc + MED_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_ATM + + + + + char + nuopc + ATM_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_OCN + + + + + char + nuopc + OCN_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_ICE + + + + + char + nuopc + ICE_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_ROF + + + + + char + nuopc + ROF_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_LND + + + + + char + nuopc + LND_attributes + + 0 + + + + + char + nuopc_attribute + nuopc_runseq + + + @86400 # 1 day time step + MED med_phases_prep_ocn + MED med_connectors_prep_med2ocn + MED -> OCN :remapMethod=redist + OCN + @48 # 30min time step + MED med_phases_prep_ice + MED med_connectors_prep_med2ice + MED -> ICE :remapMethod=redist + MED med_phases_prep_lnd + MED med_connectors_prep_med2lnd + MED -> LND :remapMethod=redist + MED med_phases_prep_rof + MED med_connectors_prep_med2rof + MED -> ROF :remapMethod=redist + ICE + LND + ROF + ROF -> MED :remapMethod=redist + MED med_connectors_post_rof2med + LND -> MED :remapMethod=redist + MED med_connectors_post_lnd2med + ICE -> MED :remapMethod=redist + MED med_connectors_post_ice2med + MED med_phases_prep_atm + MED med_connectors_prep_med2atm + MED -> ATM :remapMethod=redist + ATM + ATM -> MED :remapMethod=redist + MED med_connectors_post_atm2med + MED med_phases_accum_fast + @ + OCN -> MED :remapMethod=redist + MED med_connectors_post_ocn2med + @ + + + + + + + + + + char + expdef + DRIVER_info_attributes + acme,cesm + cime model + + cesm + acme + + + + + logical + expdef + DRIVER_info_attributes + + true => turn on aquaplanet mode in cam + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + + 1 => default sst mode for aquaplanet in cam + + + 1 + + + + + char + expdef + DRIVER_info_attributes + + case name. + + + $CASE + + + + + char + expdef + DRIVER_info_attributes + + case description. + + + $CASESTR + + + + + + + char + expdef + DRIVER_info_attributes + + username documentation + + + $USER + + + + + char + expdef + DRIVER_info_attributes + + hostname information, + + + $MACH + + + + + char + expdef + DRIVER_info_attributes + + location of timing output. + + + ./timing + + + + + char + expdef + DRIVER_info_attributes + + location of timing checkpoint output. + + + ./timing/checkpoints + + + + + char + expdef + DRIVER_info_attributes + startup,branch,continue + + mode to start the run up, [startup,branch,continue], + automatically derived from RUN_TYPE in env_run.xml + + + startup + startup + branch + continue + continue + continue + + + + + logical + expdef + DRIVER_info_attributes + + Allow same branch casename as reference casename. If $CASE and $REFCASE are the same and the start_type is + not startup, then the value of brnch_retain_casename is set to .true. + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + + Level of debug output, 0=minimum, 1=normal, 2=more, 3=too much (default: 1) + + + $INFO_DBUG + + + + + logical + expdef + DRIVER_info_attributes + + turns on bfb option in coupler which produce bfb results in the + coupler on different processor counts. (default: .false.) + + + $BFBFLAG + + + + + char + orbital + DRIVER_info_attributes + fixed_year,variable_year,fixed_parameters + + orbital model setting. this sets how the orbital mode will be + configured. + "fixed_year" uses the orb_iyear and other orb inputs are ignored. In + this mode, the orbital parameters are constant and based on the year. + "variable_year" uses the orb_iyear and orb_iyear_align. In this mode, + the orbital parameters vary as the model year advances and the model + year orb_iyear_align has the equivalent orbital year of orb_iyear. + "fixed_parameters" uses the orb_eccen, orb_mvelp, and orb_obliq to set + the orbital parameters which then remain constant through the model + integration. [fixed_year, variable_year, fixed_parameters] (default: 'fixed_year'.) + + + fixed_year + + + + + integer + orbital + DRIVER_info_attributes + + model year associated with orb_iyear when orb_mode is variable_year. (default: 1990) + + + 1990 + + + + + integer + orbital + DRIVER_info_attributes + + year of orbit, used when orb_mode is fixed_year or variable_year. (default: 1990) + + + 1990 + + + + + real + orbital + DRIVER_info_attributes + + eccentricity of orbit, used when orb_mode is fixed_parameters. + default: SHR_ORB_UNDEF_REAL (1.e36) (Not currently used in build-namelist) + + + 1.e36 + + + + + real + orbital + DRIVER_info_attributes + + location of vernal equinox in longitude degrees, used when orb_mode is fixed_parameters. + default: SHR_ORB_UNDEF_REAL (1.e36)(Not currently used in build-namelist) + + + 1.e36 + + + + + real + orbital + DRIVER_info_attributes + + obliquity of orbit in degrees, used when orb_mode is fixed_parameters. + default: SHR_ORB_UNDEF_REAL (1.e36) (Not currently used in build-namelist) + + + 1.e36 + + + + + char + wv_sat + DRIVER_info_attributes + GoffGratch,MurphyKoop,Bolton,Flatau + + Type of water vapor saturation vapor pressure scheme employed. 'GoffGratch' for + Goff and Gratch (1946); 'MurphyKoop' for Murphy and Koop (2005); 'Bolton' for + Bolton (1980); 'Flatau' for Flatau, Walko, and Cotton (1992). + Default: GoffGratch + + + GoffGratch + + + + + real + wv_sat + DRIVER_info_attributes + + Width of the liquid-ice transition range in mixed-phase water saturation vapor + pressure calculations. The range always ends at 0 degrees Celsius, so this + variable only affects the start of the transition. + Default: 20K + WARNING: CAM is tuned to the default value of this variable. Because it affects + so many different parameterizations, changes to this variable may require a + significant retuning of CAM's cloud physics to give reasonable results. + + + 20.0D0 + + + + + logical + wv_sat + DRIVER_info_attributes + + Whether or not to produce lookup tables at init time to use as a cache for + saturation vapor pressure. + Default: .false. + + + .false. + + + + + real + wv_sat + DRIVER_info_attributes + + Temperature resolution of saturation vapor pressure lookup tables in Kelvin. + (This is only used if wv_sat_use_tables is .true.) + Default: 1.0 + + + 1.0D0 + + + + + char + control + DRIVER_info_attributes + Freezing point calculation for salt water. + + $TFREEZE_SALTWATER_OPTION + + + + + char + control + DRIVER_info_attributes + off,ocn + + Only used for C,G compsets: if ocn, ocn provides EP balance factor for precip + + + $CPL_EPBAL + + + + + logical + control + DRIVER_info_attributes + + Only used for C,G compsets: if true, compute albedos to work with daily avg SW down + + + $CPL_ALBAV + + + + + char + control + DRIVER_info_attributes + on,off,on_if_glc_coupled_fluxes + + Whether to renormalize the surface mass balance (smb) sent from lnd to glc so that the + global integral on the glc grid agrees with the global integral on the lnd grid. + + Unlike most fluxes, smb is remapped with bilinear rather than conservative mapping weights, + so this option is needed for conservation. However, conservation is not required in many + cases, since we often run glc as a diagnostic (one-way-coupled) component. + + Allowable values are: + 'on': always do this renormalization + 'off': never do this renormalization (see WARNING below) + 'on_if_glc_coupled_fluxes': Determine at runtime whether to do this renormalization. + Does the renormalization if we're running a two-way-coupled glc that sends fluxes + to other components (which is the case where we need conservation). + Does NOT do the renormalization if we're running a one-way-coupled glc, or if + we're running a glc-only compset (T compsets). + (In these cases, conservation is not important.) + + Only used if running with a prognostic GLC component. + + WARNING: Setting this to 'off' will break conservation when running with an + evolving, two-way-coupled glc. + + + on_if_glc_coupled_fluxes + + + + + real + control + DRIVER_info_attributes + + Wall time limit for run + default: -1.0 + + + -1.0 + + + + + char + control + DRIVER_info_attributes + day,month,year + + Force stop at the next month, day, etc when wall_time_limit is hit + default: month + + + month + + + + + logical + control + DRIVER_info_attributes + + If true, turn on diurnal cycle in computing atm/ocn fluxes + default: false + + + .false. + + + + + real + control + DRIVER_info_attributes + + wind gustiness factor + + + 0.0D0 + + + + + char + mapping + DRIVER_info_attributes + + ATM_GRID values passed into driver. + + + $ATM_GRID + + + + + char + mapping + DRIVER_info_attributes + + LND_GRID values passed into driver. + + + $LND_GRID + + + + + char + mapping + DRIVER_info_attributes + + OCN_GRID values passed into driver. + + + $OCN_GRID + + + + + char + mapping + DRIVER_info_attributes + + ICE_GRID values passed into driver. + + + $ICE_GRID + + + + + char + mapping + DRIVER_info_attributes + + ROF_GRID values passed into driver. + + + $ROF_GRID + + + + + char + mapping + DRIVER_info_attributes + + GLC_GRID values passed into driver. + + + $GLC_GRID + + + + + char + mapping + DRIVER_info_attributes + + WAV_GRID values passed into driver. + + + $WAV_GRID + + + + + logical + mapping + DRIVER_info_attributes + + invoke pole averaging corrections in shr_map_mod weights generation (default: true) + + + .true. + + + + + char + mapping + DRIVER_info_attributes + none,npfix,cart3d,cart3d_diag,cart3d_uvw,cart3d_uvw_diag + + vect_map + turns on the vector mapping option for u and v vector mapping between + atm and ocean grids in the coupler. the options are none, npfix, + cart3d, cart3d_diag, cart3d_uvw, and cart3d_uvw_diag. the none option + results in scalar mapping independently for the u and v field which + tends to generate large errors near the poles. npfix is the + traditional option where the vectors are corrected on the ocean grid + north of the last latitude line of the atmosphere grid. the cart3d + options convert the east (u) and north (v) vectors to 3d (x,y,z) + triplets, and maps those fields before converting back to the east (u) + and north (v) directions. the cart3d ignores the resuling "w" + velocity. the cart3d_uvw calculates the resulting u and v vectors by + preserving the total "u,v,w" speed and the angle of the (u,v) vector. + the _diag options just add diagnotics to the log file about the vector + mapping. + + + $VECT_MAP + + + + + char + mapping + DRIVER_info_attributes + ocn,atm,exch + + Grid for atm ocn flux calc (untested) + default: ocn + + + ocn + + + + + logical + mapping + DRIVER_info_attributes + + mct alltoall mapping flag + default: false + + + .false. + + + + + logical + mapping + DRIVER_info_attributes + + mct vector flag + default: false + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + 0,1,2,3,4,5,6 + + cpl decomp option (0=default, 1=comp decomp, 2=rearr comp decomp, 3=new single 1d seg + default: 0 + + + $CPL_DECOMP + + + + + char + expdef + DRIVER_info_attributes + CESM1_ORIG,CESM1_MOD,CESM1_ORIG_TIGHT,CESM1_MOD_TIGHT,RASM_OPTION1,RASM_OPTION2 + + Set the coupler sequencing. + + + $CPL_SEQ_OPTION + + + + + logical + expdef + DRIVER_info_attributes + + default: true + + + .true. + + + + + logical + budget + DRIVER_info_attributes + + logical that turns on diagnostic budgets, false means budgets will never be written + + + $BUDGETS + + + + + logical + history + DRIVER_info_attributes + + logical to write an extra initial coupler history file + + + .false. + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the instantaneous budgets. [0,1,2,3], + written only if BUDGETS variable is true + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 0 + + + 0 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the daily budgets. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 0 + + + 0 + + + + + integer + expdef + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the monthy budgets. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 1 + + + 1 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the annual budgets. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 1 + + + 1 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the longterm budgets written at the end + of the year. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets, + default: 1 + + + 1 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the longterm budgets written at the end + of each run. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets, + default: 0 + + + 0 + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for instantaneous atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 1-hour average atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 1-hour instantaneous atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 3-hour average atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 3-hour average atm to coupler precip fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for daily average atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for instantaneous land to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for instantaneous runoff to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for annual sno to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + writes atm fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes lnd fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes ocn fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes ice fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes rof fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes glc fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes wav fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes xao fields in coupler average history files. + default: true + + + .true. + + + + + logical + performance + DRIVER_info_attributes + + turn on run time control of threading per pe per component by the driver + default: false + + + $DRV_THREADING + + + + + logical + performance + DRIVER_info_attributes + + default: .false. + + + $COMP_RUN_BARRIERS + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in fractions in domain checking + default: 1.0e-02 + + + $EPS_FRAC + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in atm/land masks in domain checking + default: 1.0e-13 + + + $EPS_AMASK + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in atm/land lat/lon in domain checking + default: 1.0e-12 + + + $EPS_AGRID + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in atm/land areas in domain checking + default: 1.0e-07 + + + $EPS_AAREA + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in ocean/ice masks in domain checking + default: 1.0e-06 + + + $EPS_OMASK + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in ocean/ice lon/lat in domain checking + default: 1.0e-2 + + + $EPS_OGRID + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in ocean/ice lon/lat in domain checking + default: 1.0e-1 + + + $EPS_OAREA + + + + + logical + DRIVER_info_attributes + DRIVER_info_attributes + + turns on single column mode. set by PTS_MODE in env_case.xml, default: false + + + .false. + .true. + + + + + real + DRIVER_info_attributes + DRIVER_info_attributes + + grid point latitude associated with single column mode. + if set to -999, ignore this value + + + -999. + $PTS_LAT + + + + + real + DRIVER_info_attributes + DRIVER_info_attributes + + grid point longitude associated with single column mode. + set by PTS_LON in env_run.xml. + + + -999. + $PTS_LON + + + + + logical + reprosum + DRIVER_info_attributes + + Use faster method for reprosum, but one where reproducibility is not always guaranteed. + default: .false. + + + .false. + + + + + real + reprosum + DRIVER_info_attributes + + Tolerance for relative error + default: -1.0e-8 + + + -1.0e-8 + + + + + logical + reprosum + DRIVER_info_attributes + + Recompute with non-scalable algorithm if reprosum_diffmax is exceeded. + default: .false. + + + .false. + + + + + char + expdef + DRIVER_info_attributes + + Model version + + + unknown + + + + + char + expdef + DRIVER_info_attributes + + Driver restart pointer file. + + + rpointer.drv + + + + + char + expdef + DRIVER_info_attributes + + Full archive path to restart file + + + str_undefined + + + + + char + expdef + DRIVER_info_attributes + + Ending suffix "postfix" for output log files. + + + .log + + + + + char + expdef + DRIVER_info_attributes + + Root for output log files. + + + ./ + + + + + logical + expdef + DRIVER_info_attributes + + Perpetual flag + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + + Perpetual date + + + -999 + + + + + real + expdef + DRIVER_info_attributes + + Abort if cplstep time exceeds this value + + + 0. + + + + + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ocn flux mapping file for fluxes + + + $ATM2OCN_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ocn state mapping file for states + + + $ATM2OCN_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ocn state mapping file for velocity + + + $ATM2OCN_VMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_VMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ocn to atm mapping file for fluxes + + + $OCN2ATM_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ocn to atm mapping file for states + + + $OCN2ATM_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ice flux mapping file for fluxes + + + $ATM2OCN_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ice state mapping file for states + + + $ATM2OCN_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ice state mapping file for velocity + + + $ATM2OCN_VMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_VMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ice to atm mapping file for fluxes + + + $OCN2ATM_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ice to atm mapping file for states + + + $OCN2ATM_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to land mapping file for fluxes + + + $ATM2LND_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2LND_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to land mapping file for states + + + $ATM2LND_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2LND_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to atm mapping file for fluxes + + + $LND2ATM_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2ATM_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to atm mapping file for states + + + $LND2ATM_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2ATM_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + lnd to runoff conservative mapping file + + + $LND2ROF_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2ROF_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to lnd conservative mapping file + + + $ROF2LND_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2LND_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to ocn area overlap conservative mapping file + + + $ROF2OCN_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2OCN_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to ocn runoff conservative mapping file + + + $GLC2OCN_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2OCN_RMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to ice runoff conservative mapping file + + + $GLC2ICE_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2ICE_RMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to ocn nearest neighbor plus smoothing conservative mapping file + + + $ROF2OCN_LIQ_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2OCN_LIQ_RMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to ocn nearest neighbor plus smoothing conservative mapping file + + + $ROF2OCN_ICE_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2OCN_ICE_RMAPTYPE + X + + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to glc mapping file for fluxes + + + $LND2GLC_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2GLC_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to glc mapping file for states + + + $LND2GLC_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2GLC_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to land mapping file for fluxes + + + $GLC2LND_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2LND_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to land mapping file for states + + + $GLC2LND_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2LND_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to wav state mapping file for states + + + $ATM2WAV_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2WAV_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ocn to wav state mapping file for states + + + $OCN2WAV_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2WAV_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ice to wav state mapping file for states + + + $ICE2WAV_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ICE2WAV_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + wav to ocn state mapping file for states + + + $WAV2OCN_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $WAV2OCN_SMAPTYPE + X + + + + + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x history fields + + + Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x precipitation history output every 3 hours + + + Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x history output every 24 hours + + + Faxa_bcphiwet:Faxa_bcphodry:Faxa_bcphidry:Faxa_ocphiwet:Faxa_ocphidry:Faxa_ocphodry:Faxa_dstwet1:Faxa_dstdry1:Faxa_dstwet2:Faxa_dstdry2:Faxa_dstwet3:Faxa_dstdry3:Faxa_dstwet4:Faxa_dstdry4:Sa_co2prog:Sa_co2diag + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x instantaneous history output every hour + + + Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x averaged history output every hour + + + Sa_u:Sa_v + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x averaged history output every 3 hours + + + Sa_z:Sa_topo:Sa_u:Sa_v:Sa_tbot:Sa_ptem:Sa_shum:Sa_dens:Sa_pbot:Sa_pslv:Faxa_lwdn:Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl:Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf:Sa_co2diag:Sa_co2prog + + + + diff --git a/src/drivers/mct/main/cesm_comp_mod.F90 b/src/drivers/mct/main/cesm_comp_mod.F90 index 9e3fca20949..4260b3c6515 100644 --- a/src/drivers/mct/main/cesm_comp_mod.F90 +++ b/src/drivers/mct/main/cesm_comp_mod.F90 @@ -99,16 +99,6 @@ module cesm_comp_mod use seq_timemgr_mod, only: seq_timemgr_alarm_wavrun use seq_timemgr_mod, only: seq_timemgr_alarm_esprun use seq_timemgr_mod, only: seq_timemgr_alarm_barrier - use seq_timemgr_mod, only: seq_SyncClock => seq_timemgr_SyncClock - use seq_timemgr_mod, only: EClock_d => seq_timemgr_Eclock_d - use seq_timemgr_mod, only: EClock_a => seq_timemgr_Eclock_a - use seq_timemgr_mod, only: EClock_l => seq_timemgr_Eclock_l - use seq_timemgr_mod, only: EClock_o => seq_timemgr_Eclock_o - use seq_timemgr_mod, only: EClock_i => seq_timemgr_Eclock_i - use seq_timemgr_mod, only: EClock_g => seq_timemgr_Eclock_g - use seq_timemgr_mod, only: EClock_r => seq_timemgr_Eclock_r - use seq_timemgr_mod, only: EClock_w => seq_timemgr_Eclock_w - use seq_timemgr_mod, only: EClock_e => seq_timemgr_Eclock_e use seq_timemgr_mod, only: seq_timemgr_alarm_pause use seq_timemgr_mod, only: seq_timemgr_pause_active use seq_timemgr_mod, only: seq_timemgr_pause_component_active @@ -119,7 +109,6 @@ module cesm_comp_mod use seq_infodata_mod, only: seq_infodata_init, seq_infodata_exchange use seq_infodata_mod, only: seq_infodata_type, seq_infodata_orb_variable_year use seq_infodata_mod, only: seq_infodata_print, seq_infodata_init2 - use seq_infodata_mod, only: infodata=>seq_infodata_infodata ! domain related routines use seq_domain_mct, only : seq_domain_check @@ -239,23 +228,22 @@ module cesm_comp_mod ! Infodata: inter-model control flags, domain info !---------------------------------------------------------------------------- -! tcraig moved to seq_infodata_mod for NUOPC use temporarily -! type (seq_infodata_type), target :: infodata ! single instance for cpl and all comps + type (seq_infodata_type), target :: infodata ! single instance for cpl and all comps !---------------------------------------------------------------------------- ! time management !---------------------------------------------------------------------------- -! type (seq_timemgr_type), SAVE :: seq_SyncClock ! array of all clocks & alarm -! type (ESMF_Clock), target :: EClock_d ! driver clock -! type (ESMF_Clock), target :: EClock_a ! atmosphere clock -! type (ESMF_Clock), target :: EClock_l ! land clock -! type (ESMF_Clock), target :: EClock_o ! ocean clock -! type (ESMF_Clock), target :: EClock_i ! ice clock -! type (ESMF_Clock), target :: EClock_g ! glc clock -! type (ESMF_Clock), target :: EClock_r ! rof clock -! type (ESMF_Clock), target :: EClock_w ! wav clock -! type (ESMF_Clock), target :: EClock_e ! esp clock + type (seq_timemgr_type), SAVE :: seq_SyncClock ! array of all clocks & alarm + type (ESMF_Clock), target :: EClock_d ! driver clock + type (ESMF_Clock), target :: EClock_a ! atmosphere clock + type (ESMF_Clock), target :: EClock_l ! land clock + type (ESMF_Clock), target :: EClock_o ! ocean clock + type (ESMF_Clock), target :: EClock_i ! ice clock + type (ESMF_Clock), target :: EClock_g ! glc clock + type (ESMF_Clock), target :: EClock_r ! rof clock + type (ESMF_Clock), target :: EClock_w ! wav clock + type (ESMF_Clock), target :: EClock_e ! esp clock logical :: restart_alarm ! restart alarm logical :: history_alarm ! history alarm @@ -606,16 +594,11 @@ subroutine cesm_pre_init1() integer, dimension(num_inst_total) :: comp_id, comp_comm, comp_comm_iam logical :: comp_iamin(num_inst_total) - logical :: flag character(len=seq_comm_namelen) :: comp_name(num_inst_total) integer :: i, it - call mpi_initialized(flag,ierr) - call shr_mpi_chkerr(ierr,subname//' mpi_initialized') - if (.not. flag) then - call mpi_init(ierr) - call shr_mpi_chkerr(ierr,subname//' mpi_init') - endif + call mpi_init(ierr) + call shr_mpi_chkerr(ierr,subname//' mpi_init') Global_Comm=MPI_COMM_WORLD comp_comm = MPI_COMM_NULL diff --git a/src/drivers/mct/shr/seq_flds_mod.F90 b/src/drivers/mct/shr/seq_flds_mod.F90 index 4cda01e4895..e41814a3501 100644 --- a/src/drivers/mct/shr/seq_flds_mod.F90 +++ b/src/drivers/mct/shr/seq_flds_mod.F90 @@ -123,7 +123,7 @@ module seq_flds_mod use shr_kind_mod , only : CX => shr_kind_CX, CXX => shr_kind_CXX use shr_sys_mod , only : shr_sys_abort - use seq_comm_mct , only : seq_comm_iamroot, seq_comm_setptrs, llogunit => logunit + use seq_comm_mct , only : seq_comm_iamroot, seq_comm_setptrs, logunit use seq_drydep_mod , only : seq_drydep_init, seq_drydep_readnl, lnd_drydep use shr_megan_mod , only : shr_megan_readnl, shr_megan_mechcomps_n use shr_fire_emis_mod , only : shr_fire_emis_readnl, shr_fire_emis_mechcomps_n, shr_fire_emis_ztop_token @@ -158,23 +158,6 @@ module seq_flds_mod integer :: n_entries = 0 ! actual number of entries in lookup_entry character(len=CSS), dimension(nmax, 4) :: lookup_entry = undef - !---------------------------------------------------------------------------- - ! for the scalars - !---------------------------------------------------------------------------- - - character(len=*) ,parameter :: seq_flds_scalar_name = "cpl_scalars" - integer ,parameter :: seq_flds_scalar_num = 10 - integer ,parameter :: seq_flds_scalar_index_present = 1, & - seq_flds_scalar_index_prognostic = 2, & - seq_flds_scalar_index_nx = 3, & - seq_flds_scalar_index_ny = 4, & - seq_flds_scalar_index_atm_aero = 5, & - seq_flds_scalar_index_precip_fact = 6, & - seq_flds_scalar_index_nextsw_cday = 7, & - seq_flds_scalar_index_g2lupdate = 8, & - seq_flds_scalar_index_dead_comps = 9, & - seq_flds_scalar_index_phase = 10 - !---------------------------------------------------------------------------- ! for the domain !---------------------------------------------------------------------------- @@ -400,7 +383,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) seq_flds_i2o_per_cat = .false. unitn = shr_file_getUnit() - write(llogunit,"(A)") subname//': read seq_cplflds_inparm namelist from: '& + write(logunit,"(A)") subname//': read seq_cplflds_inparm namelist from: '& //trim(nmlfile) open( unitn, file=trim(nmlfile), status='old' ) ierr = 1 @@ -437,7 +420,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) cplflds_custom(:) = ' ' unitn = shr_file_getUnit() - write(llogunit,"(A)") subname//': read seq_cplflds_userspec namelist from: '& + write(logunit,"(A)") subname//': read seq_cplflds_userspec namelist from: '& //trim(nmlfile) open( unitn, file=trim(nmlfile), status='old' ) ierr = 1 @@ -473,7 +456,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) is_state = .false. is_flux = .true. else - write(llogunit,*) subname//'ERROR: fldname must start with S,F,P, not ',trim(fldname) + write(logunit,*) subname//'ERROR: fldname must start with S,F,P, not ',trim(fldname) call shr_sys_abort(subname//"ERROR: fldname must start with S, F, or P") end if @@ -515,7 +498,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) if (is_state) call seq_flds_add(x2g_states,trim(fldname)) if (is_flux ) call seq_flds_add(x2g_fluxes,trim(fldname)) case default - write(llogunit,*) subname//'ERROR: ',trim(cplflds_custom(n)),& + write(logunit,*) subname//'ERROR: ',trim(cplflds_custom(n)),& ' not a recognized value' call shr_sys_abort() end select @@ -524,16 +507,6 @@ subroutine seq_flds_set(nmlfile, ID, infodata) end if end do - !---------------------------------------------------------- - ! scalar information - !---------------------------------------------------------- - - longname = trim(seq_flds_scalar_name) - stdname = trim(seq_flds_scalar_name) - units = 'unitless' - attname = trim(seq_flds_scalar_name) - call metadata_set(attname, longname, stdname, units) - !---------------------------------------------------------- ! domain coordinates !---------------------------------------------------------- @@ -1090,13 +1063,10 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call metadata_set(attname, longname, stdname, units) ! Surface temperature - call seq_flds_add(o2x_states,"So_t") call seq_flds_add(l2x_states,"Sl_t") call seq_flds_add(i2x_states,"Si_t") - call seq_flds_add(x2a_states,"Sx_t") call seq_flds_add(x2a_states,"So_t") - call seq_flds_add(x2i_states,"So_t") - call seq_flds_add(x2w_states,"So_t") + call seq_flds_add(x2a_states,"Sx_t") longname = 'Surface temperature' stdname = 'surface_temperature' units = 'K' @@ -1122,9 +1092,9 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(l2x_states,"Sl_ram1") call seq_flds_add(x2a_states,"Sl_ram1") longname = 'aerodynamic resistance' - stdname = 'aerodynamic_resistance' - attname = 'Sl_ram1' - units = 's/m' + stdname = 'aerodynamic_resistance' + attname = 'SI_ram1' + units = 's/m' call metadata_set(attname, longname, stdname, units) @@ -1159,8 +1129,8 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(xao_states,"So_re") call seq_flds_add(x2a_states,"So_re") longname = 'Square of exch. coeff (tracers)' - stdname = 'square_of_exch_coeff' - units = '1' + stdname = '' + units = '' attname = 'So_re' call metadata_set(attname, longname, stdname, units) @@ -1172,13 +1142,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) longname = '10m wind' stdname = '10m_wind' units = 'm' - attname = 'Si_u10' - call metadata_set(attname, longname, stdname, units) - attname = 'So_u10' - call metadata_set(attname, longname, stdname, units) - attname = 'Sl_u10' - call metadata_set(attname, longname, stdname, units) - attname = 'Sx_u10' + attname = 'u10' call metadata_set(attname, longname, stdname, units) ! Zonal surface stress" @@ -1304,8 +1268,6 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call metadata_set(attname, longname, stdname, units) attname = 'Faxx_evap' call metadata_set(attname, longname, stdname, units) - attname = 'Foxx_evap' - call metadata_set(attname, longname, stdname, units) ! Dust flux (particle bin number 1) call seq_flds_add(l2x_fluxes,"Fall_flxdst1") @@ -1484,6 +1446,11 @@ subroutine seq_flds_set(nmlfile, ID, infodata) attname = 'Fioi_flxdst' call metadata_set(attname, longname, stdname, units) + ! Sea surface temperature + call seq_flds_add(o2x_states,"So_t") + call seq_flds_add(x2i_states,"So_t") + call seq_flds_add(x2w_states,"So_t") + ! Sea surface salinity call seq_flds_add(o2x_states,"So_s") call seq_flds_add(x2i_states,"So_s") @@ -1511,7 +1478,6 @@ subroutine seq_flds_set(nmlfile, ID, infodata) stdname = 'northward_sea_water_velocity' units = 'm s-1' attname = 'So_v' - call metadata_set(attname, longname, stdname, units) ! Zonal sea surface slope call seq_flds_add(o2x_states,"So_dhdx") @@ -2085,7 +2051,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(x2o_states,'Sw_lamult') longname = 'Langmuir multiplier' stdname = 'wave_model_langmuir_multiplier' - units = '1' + units = '' attname = 'Sw_lamult' call metadata_set(attname, longname, stdname, units) @@ -2408,7 +2374,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(x2l_states, "Sa_co2prog") call seq_flds_add(x2o_states, "Sa_co2prog") longname = 'Prognostic CO2 at the lowest model level' - stdname = 'prognostic_CO2_lowest_level' + stdname = '' units = '1e-6 mol/mol' attname = 'Sa_co2prog' call metadata_set(attname, longname, stdname, units) @@ -2417,7 +2383,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(x2l_states, "Sa_co2diag") call seq_flds_add(x2o_states, "Sa_co2diag") longname = 'Diagnostic CO2 at the lowest model level' - stdname = 'diagnostic_CO2_lowest_level' + stdname = '' units = '1e-6 mol/mol' attname = 'Sa_co2diag' call metadata_set(attname, longname, stdname, units) @@ -2427,7 +2393,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(a2x_states, "Sa_co2prog") call seq_flds_add(x2l_states, "Sa_co2prog") longname = 'Prognostic CO2 at the lowest model level' - stdname = 'prognostic_CO2_lowest_level' + stdname = '' units = '1e-6 mol/mol' attname = 'Sa_co2prog' call metadata_set(attname, longname, stdname, units) @@ -2435,7 +2401,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(a2x_states, "Sa_co2diag") call seq_flds_add(x2l_states, "Sa_co2diag") longname = 'Diagnostic CO2 at the lowest model level' - stdname = 'diagnostic_CO2_lowest_level' + stdname = '' units = '1e-6 mol/mol' attname = 'Sa_co2diag' call metadata_set(attname, longname, stdname, units) @@ -2454,7 +2420,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(x2l_states, "Sa_co2prog") call seq_flds_add(x2o_states, "Sa_co2prog") longname = 'Prognostic CO2 at the lowest model level' - stdname = 'prognostic_CO2_lowest_level' + stdname = '' units = '1e-6 mol/mol' attname = 'Sa_co2prog' call metadata_set(attname, longname, stdname, units) @@ -2463,7 +2429,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(x2l_states, "Sa_co2diag") call seq_flds_add(x2o_states, "Sa_co2diag") longname = 'Diagnostic CO2 at the lowest model level' - stdname = 'diagnostic_CO2_lowest_level' + stdname = '' units = '1e-6 mol/mol' attname = 'Sa_co2diag' call metadata_set(attname, longname, stdname, units) @@ -2489,7 +2455,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(a2x_states, "Sa_co2prog") call seq_flds_add(x2l_states, "Sa_co2prog") longname = 'Prognostic CO2 at the lowest model level' - stdname = 'prognostic_CO2_lowest_level' + stdname = '' units = '1e-6 mol/mol' attname = 'Sa_co2prog' call metadata_set(attname, longname, stdname, units) @@ -2497,7 +2463,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(a2x_states, "Sa_co2diag") call seq_flds_add(x2l_states, "Sa_co2diag") longname = 'Diagnostic CO2 at the lowest model level' - stdname = 'diagnostic_CO2_lowest_level' + stdname = '' units = '1e-6 mol/mol' attname = 'Sa_co2diag' call metadata_set(attname, longname, stdname, units) @@ -2532,8 +2498,8 @@ subroutine seq_flds_set(nmlfile, ID, infodata) call seq_flds_add(o2x_states, "So_roce_16O") call seq_flds_add(x2i_states, "So_roce_16O") longname = 'Ratio of ocean surface level abund. H2_16O/H2O/Rstd' - stdname = 'ratio_ocean_surface_16O_abund' - units = '1' + stdname = '' + units = ' ' attname = 'So_roce_16O' call metadata_set(attname, longname, stdname, units) @@ -3256,38 +3222,38 @@ subroutine seq_flds_set(nmlfile, ID, infodata) seq_flds_r2o_ice_fluxes = trim(r2o_ice_fluxes) if (seq_comm_iamroot(ID)) then - write(llogunit,"(A)") subname//': seq_flds_a2x_states= ',trim(seq_flds_a2x_states) - write(llogunit,"(A)") subname//': seq_flds_a2x_fluxes= ',trim(seq_flds_a2x_fluxes) - write(llogunit,"(A)") subname//': seq_flds_x2a_states= ',trim(seq_flds_x2a_states) - write(llogunit,"(A)") subname//': seq_flds_x2a_fluxes= ',trim(seq_flds_x2a_fluxes) - write(llogunit,"(A)") subname//': seq_flds_l2x_states= ',trim(seq_flds_l2x_states) - write(llogunit,"(A)") subname//': seq_flds_l2x_fluxes= ',trim(seq_flds_l2x_fluxes) - write(llogunit,"(A)") subname//': seq_flds_x2l_states= ',trim(seq_flds_x2l_states) - write(llogunit,"(A)") subname//': seq_flds_x2l_fluxes= ',trim(seq_flds_x2l_fluxes) - write(llogunit,"(A)") subname//': seq_flds_i2x_states= ',trim(seq_flds_i2x_states) - write(llogunit,"(A)") subname//': seq_flds_i2x_fluxes= ',trim(seq_flds_i2x_fluxes) - write(llogunit,"(A)") subname//': seq_flds_x2i_states= ',trim(seq_flds_x2i_states) - write(llogunit,"(A)") subname//': seq_flds_x2i_fluxes= ',trim(seq_flds_x2i_fluxes) - write(llogunit,"(A)") subname//': seq_flds_o2x_states= ',trim(seq_flds_o2x_states) - write(llogunit,"(A)") subname//': seq_flds_o2x_fluxes= ',trim(seq_flds_o2x_fluxes) - write(llogunit,"(A)") subname//': seq_flds_x2o_states= ',trim(seq_flds_x2o_states) - write(llogunit,"(A)") subname//': seq_flds_x2o_fluxes= ',trim(seq_flds_x2o_fluxes) - write(llogunit,"(A)") subname//': seq_flds_g2x_states= ',trim(seq_flds_g2x_states) - write(llogunit,"(A)") subname//': seq_flds_g2x_fluxes= ',trim(seq_flds_g2x_fluxes) - write(llogunit,"(A)") subname//': seq_flds_x2g_states= ',trim(seq_flds_x2g_states) - write(llogunit,"(A)") subname//': seq_flds_x2g_fluxes= ',trim(seq_flds_x2g_fluxes) - write(llogunit,"(A)") subname//': seq_flds_xao_states= ',trim(seq_flds_xao_states) - write(llogunit,"(A)") subname//': seq_flds_xao_fluxes= ',trim(seq_flds_xao_fluxes) - write(llogunit,"(A)") subname//': seq_flds_xao_albedo= ',trim(seq_flds_xao_albedo) - write(llogunit,"(A)") subname//': seq_flds_xao_diurnl= ',trim(seq_flds_xao_diurnl) - write(llogunit,"(A)") subname//': seq_flds_r2x_states= ',trim(seq_flds_r2x_states) - write(llogunit,"(A)") subname//': seq_flds_r2x_fluxes= ',trim(seq_flds_r2x_fluxes) - write(llogunit,"(A)") subname//': seq_flds_x2r_states= ',trim(seq_flds_x2r_states) - write(llogunit,"(A)") subname//': seq_flds_x2r_fluxes= ',trim(seq_flds_x2r_fluxes) - write(llogunit,"(A)") subname//': seq_flds_w2x_states= ',trim(seq_flds_w2x_states) - write(llogunit,"(A)") subname//': seq_flds_w2x_fluxes= ',trim(seq_flds_w2x_fluxes) - write(llogunit,"(A)") subname//': seq_flds_x2w_states= ',trim(seq_flds_x2w_states) - write(llogunit,"(A)") subname//': seq_flds_x2w_fluxes= ',trim(seq_flds_x2w_fluxes) + write(logunit,"(A)") subname//': seq_flds_a2x_states= ',trim(seq_flds_a2x_states) + write(logunit,"(A)") subname//': seq_flds_a2x_fluxes= ',trim(seq_flds_a2x_fluxes) + write(logunit,"(A)") subname//': seq_flds_x2a_states= ',trim(seq_flds_x2a_states) + write(logunit,"(A)") subname//': seq_flds_x2a_fluxes= ',trim(seq_flds_x2a_fluxes) + write(logunit,"(A)") subname//': seq_flds_l2x_states= ',trim(seq_flds_l2x_states) + write(logunit,"(A)") subname//': seq_flds_l2x_fluxes= ',trim(seq_flds_l2x_fluxes) + write(logunit,"(A)") subname//': seq_flds_x2l_states= ',trim(seq_flds_x2l_states) + write(logunit,"(A)") subname//': seq_flds_x2l_fluxes= ',trim(seq_flds_x2l_fluxes) + write(logunit,"(A)") subname//': seq_flds_i2x_states= ',trim(seq_flds_i2x_states) + write(logunit,"(A)") subname//': seq_flds_i2x_fluxes= ',trim(seq_flds_i2x_fluxes) + write(logunit,"(A)") subname//': seq_flds_x2i_states= ',trim(seq_flds_x2i_states) + write(logunit,"(A)") subname//': seq_flds_x2i_fluxes= ',trim(seq_flds_x2i_fluxes) + write(logunit,"(A)") subname//': seq_flds_o2x_states= ',trim(seq_flds_o2x_states) + write(logunit,"(A)") subname//': seq_flds_o2x_fluxes= ',trim(seq_flds_o2x_fluxes) + write(logunit,"(A)") subname//': seq_flds_x2o_states= ',trim(seq_flds_x2o_states) + write(logunit,"(A)") subname//': seq_flds_x2o_fluxes= ',trim(seq_flds_x2o_fluxes) + write(logunit,"(A)") subname//': seq_flds_g2x_states= ',trim(seq_flds_g2x_states) + write(logunit,"(A)") subname//': seq_flds_g2x_fluxes= ',trim(seq_flds_g2x_fluxes) + write(logunit,"(A)") subname//': seq_flds_x2g_states= ',trim(seq_flds_x2g_states) + write(logunit,"(A)") subname//': seq_flds_x2g_fluxes= ',trim(seq_flds_x2g_fluxes) + write(logunit,"(A)") subname//': seq_flds_xao_states= ',trim(seq_flds_xao_states) + write(logunit,"(A)") subname//': seq_flds_xao_fluxes= ',trim(seq_flds_xao_fluxes) + write(logunit,"(A)") subname//': seq_flds_xao_albedo= ',trim(seq_flds_xao_albedo) + write(logunit,"(A)") subname//': seq_flds_xao_diurnl= ',trim(seq_flds_xao_diurnl) + write(logunit,"(A)") subname//': seq_flds_r2x_states= ',trim(seq_flds_r2x_states) + write(logunit,"(A)") subname//': seq_flds_r2x_fluxes= ',trim(seq_flds_r2x_fluxes) + write(logunit,"(A)") subname//': seq_flds_x2r_states= ',trim(seq_flds_x2r_states) + write(logunit,"(A)") subname//': seq_flds_x2r_fluxes= ',trim(seq_flds_x2r_fluxes) + write(logunit,"(A)") subname//': seq_flds_w2x_states= ',trim(seq_flds_w2x_states) + write(logunit,"(A)") subname//': seq_flds_w2x_fluxes= ',trim(seq_flds_w2x_fluxes) + write(logunit,"(A)") subname//': seq_flds_x2w_states= ',trim(seq_flds_x2w_states) + write(logunit,"(A)") subname//': seq_flds_x2w_fluxes= ',trim(seq_flds_x2w_fluxes) end if call catFields(seq_flds_dom_fields, seq_flds_dom_coord , seq_flds_dom_other ) @@ -3350,8 +3316,8 @@ subroutine seq_flds_add(outfld, str) outfld = trim(outfld)//':'//trim(str) end if if (len_trim(outfld) >= CXX) then - write(llogunit,*)'fields are = ',trim(outfld) - write(llogunit,*)'fields length = ',len_trim(outfld) + write(logunit,*)'fields are = ',trim(outfld) + write(logunit,*)'fields length = ',len_trim(outfld) call shr_sys_abort(subname//'ERROR: maximum length of xxx_states or xxx_fluxes has been exceeded') end if @@ -3497,7 +3463,7 @@ subroutine metadata_set(attname , longname, stdname , units ) if (n_entries .ge. nmax) then - write(llogunit,*)'n_entries= ',n_entries,' nmax = ',nmax,' attname= ',trim(attname) + write(logunit,*)'n_entries= ',n_entries,' nmax = ',nmax,' attname= ',trim(attname) call shr_sys_abort(subname//'ERROR: nmax fields in lookup_entry table exceeded') end if @@ -3565,55 +3531,6 @@ subroutine set_glc_elevclass_field(name, attname, longname, stdname, units, fiel end if end subroutine set_glc_elevclass_field - - subroutine seq_flds_get_num_entries(num_entries) - - ! !USES: - implicit none - - ! !INPUT/OUTPUT PARAMETERS: - integer, intent(out) :: num_entries - - character(len=*),parameter :: subname = '(seq_flds_get_num_entries) ' - - num_entries = n_entries - - end subroutine seq_flds_get_num_entries - - !=============================================================================== - - subroutine seq_flds_get_entry(nentry, shortname, longname, stdname, units) - - ! !USES: - implicit none - - ! !INPUT/OUTPUT PARAMETERS: - integer, intent(in) :: nentry - character(len=*),optional, intent(out) :: shortname - character(len=*),optional, intent(out) :: longname - character(len=*),optional, intent(out) :: stdname - character(len=*),optional, intent(out) :: units - - character(len=*),parameter :: subname = '(seq_flds_get_entry) ' - - if (present(shortname)) then - shortname = trim(lookup_entry(nentry,1)) - endif - - if (present(longname)) then - longname = trim(lookup_entry(nentry,2)) - endif - - if (present(stdname)) then - stdname = trim(lookup_entry(nentry,3)) - endif - - if (present(units)) then - units = trim(lookup_entry(nentry,4)) - endif - - end subroutine seq_flds_get_entry - !=============================================================================== subroutine seq_flds_esmf_metadata_get(shortname, longname, stdname, units) @@ -3688,7 +3605,5 @@ subroutine seq_flds_esmf_metadata_get(shortname, longname, stdname, units) end subroutine seq_flds_esmf_metadata_get - !=============================================================================== - end module seq_flds_mod diff --git a/src/drivers/mct/shr/seq_infodata_mod.F90 b/src/drivers/mct/shr/seq_infodata_mod.F90 index dade2b4b9d9..01c6b67689f 100644 --- a/src/drivers/mct/shr/seq_infodata_mod.F90 +++ b/src/drivers/mct/shr/seq_infodata_mod.F90 @@ -53,7 +53,6 @@ MODULE seq_infodata_mod public :: seq_infodata_Exchange ! exchange data across pes ! !PUBLIC DATA MEMBERS: - public :: seq_infodata_infodata ! instance of infodata datatype !EOP @@ -249,8 +248,6 @@ MODULE seq_infodata_mod logical :: glc_valid_input ! is valid accumulated data being sent to prognostic glc end type seq_infodata_type - type (seq_infodata_type), target :: seq_infodata_infodata ! single instance for cpl and all comps - ! --- public interfaces -------------------------------------------------------- interface seq_infodata_GetData module procedure seq_infodata_GetData_explicit diff --git a/src/drivers/mct/shr/seq_timemgr_mod.F90 b/src/drivers/mct/shr/seq_timemgr_mod.F90 index c3f17b1c5d1..ed36dbdfd2a 100644 --- a/src/drivers/mct/shr/seq_timemgr_mod.F90 +++ b/src/drivers/mct/shr/seq_timemgr_mod.F90 @@ -224,17 +224,6 @@ module seq_timemgr_mod type(ESMF_Alarm) :: EAlarm(max_clocks,max_alarms) ! array of clock alarms end type seq_timemgr_type - type (seq_timemgr_type),public :: seq_timemgr_SyncClock ! array of all clocks & alarm - type (ESMF_clock),public, target :: seq_timemgr_EClock_d ! driver clock - type (ESMF_clock),public, target :: seq_timemgr_EClock_a - type (ESMF_clock),public, target :: seq_timemgr_EClock_l - type (ESMF_clock),public, target :: seq_timemgr_EClock_o - type (ESMF_clock),public, target :: seq_timemgr_EClock_i - type (ESMF_clock),public, target :: seq_timemgr_EClock_g - type (ESMF_clock),public, target :: seq_timemgr_EClock_r - type (ESMF_clock),public, target :: seq_timemgr_EClock_w - type (ESMF_clock),public, target :: seq_timemgr_EClock_e - ! --- Private local data ---------------------------------------------------- type(ESMF_Calendar), target, save :: seq_timemgr_cal ! calendar diff --git a/src/drivers/nuopc/cime_config/buildexe b/src/drivers/nuopc/cime_config/buildexe new file mode 100755 index 00000000000..24eb1c53db8 --- /dev/null +++ b/src/drivers/nuopc/cime_config/buildexe @@ -0,0 +1,59 @@ +#!/usr/bin/env python + +""" +build model executable +""" + +import sys, os + +_CIMEROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..","..","..","..") +sys.path.append(os.path.join(_CIMEROOT, "scripts", "Tools")) + +from standard_script_setup import * +from CIME.buildlib import parse_input +from CIME.case import Case +from CIME.utils import expect, run_cmd + +logger = logging.getLogger(__name__) + +############################################################################### +def _main_func(): +############################################################################### + + caseroot, libroot, _ = parse_input(sys.argv) + + logger.info("Building a single executable version of target coupled model") + + with Case(caseroot) as case: + casetools = case.get_value("CASETOOLS") + cimeroot = case.get_value("CIMEROOT") + exeroot = case.get_value("EXEROOT") + gmake = case.get_value("GMAKE") + gmake_j = case.get_value("GMAKE_J") + model = case.get_value("MODEL") + num_esp = case.get_value("NUM_COMP_INST_ESP") + os.environ["PIO_VERSION"] = str(case.get_value("PIO_VERSION")) + + expect((num_esp is None) or (int(num_esp) == 1), "ESP component restricted to one instance") + + with open('Filepath', 'w') as out: + out.write(os.path.join(caseroot, "SourceMods", "src.drv") + "\n") + out.write(os.path.join(cimeroot, "src", "drivers", "nuopc", "cime_driver") + "\n") + out.write(os.path.join(cimeroot, "src", "drivers", "nuopc", "mediator") + "\n") + + # build model executable + + makefile = os.path.join(casetools, "Makefile") + exename = os.path.join(exeroot, model + ".exe") + + cmd = "%s exec_se -j %d EXEC_SE=%s MODEL=%s LIBROOT=%s -f %s "\ + % (gmake, gmake_j, exename, "driver", libroot, makefile) + + rc, out, err = run_cmd(cmd) + expect(rc==0,"Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) + logger.info(out) + +############################################################################### + +if __name__ == "__main__": + _main_func() diff --git a/src/drivers/nuopc/cime_config/buildnml b/src/drivers/nuopc/cime_config/buildnml new file mode 100755 index 00000000000..a312c49dcf0 --- /dev/null +++ b/src/drivers/nuopc/cime_config/buildnml @@ -0,0 +1,393 @@ +#!/usr/bin/env python +"""Namelist creator for CIME's driver. +""" +# Typically ignore this. +# pylint: disable=invalid-name + +# Disable these because this is our standard setup +# pylint: disable=wildcard-import,unused-wildcard-import,wrong-import-position + +import os, shutil, sys, glob, itertools + +_CIMEROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..","..","..","..") +sys.path.append(os.path.join(_CIMEROOT, "scripts", "Tools")) + +from standard_script_setup import * +from CIME.case import Case +from CIME.nmlgen import NamelistGenerator +from CIME.utils import expect +from CIME.utils import get_model, get_time_in_seconds, get_timestamp +from CIME.buildnml import create_namelist_infile, parse_input +from CIME.XML.files import Files + +logger = logging.getLogger(__name__) + +############################################################################### +def _create_drv_namelists(case, infile, confdir, nmlgen, files): +############################################################################### + + #-------------------------------- + # Set up config dictionary + #-------------------------------- + config = {} + config['cime_model'] = get_model() + config['BGC_MODE'] = case.get_value("CCSM_BGC") + config['CPL_I2O_PER_CAT'] = case.get_value('CPL_I2O_PER_CAT') + config['COMP_RUN_BARRIERS'] = case.get_value('COMP_RUN_BARRIERS') + config['DRV_THREADING'] = case.get_value('DRV_THREADING') + config['CPL_ALBAV'] = case.get_value('CPL_ALBAV') + config['CPL_EPBAL'] = case.get_value('CPL_EPBAL') + config['FLDS_WISO'] = case.get_value('FLDS_WISO') + config['BUDGETS'] = case.get_value('BUDGETS') + config['MACH'] = case.get_value('MACH') + config['MPILIB'] = case.get_value('MPILIB') + config['OS'] = case.get_value('OS') + config['glc_nec'] = 0 if case.get_value('GLC_NEC') == 0 else case.get_value('GLC_NEC') + config['single_column'] = 'true' if case.get_value('PTS_MODE') else 'false' + config['timer_level'] = 'pos' if case.get_value('TIMER_LEVEL') >= 1 else 'neg' + config['bfbflag'] = 'on' if case.get_value('BFBFLAG') else 'off' + config['continue_run'] = '.true.' if case.get_value('CONTINUE_RUN') else '.false.' + + if case.get_value('RUN_TYPE') == 'startup': + config['run_type'] = 'startup' + elif case.get_value('RUN_TYPE') == 'hybrid': + config['run_type'] = 'startup' + elif case.get_value('RUN_TYPE') == 'branch': + config['run_type'] = 'branch' + + #---------------------------------------------------- + # Initialize namelist defaults + #---------------------------------------------------- + nmlgen.init_defaults(infile, config) + + #-------------------------------- + # Overwrite: set component coupling frequencies + #-------------------------------- + ncpl_base_period = case.get_value('NCPL_BASE_PERIOD') + if ncpl_base_period == 'hour': + basedt = 3600 + elif ncpl_base_period == 'day': + basedt = 3600 * 24 + elif ncpl_base_period == 'year': + if case.get_value('CALENDAR') == 'NO_LEAP': + basedt = 3600 * 24 * 365 + else: + expect(False, "Invalid CALENDAR for NCPL_BASE_PERIOD %s " %ncpl_base_period) + elif ncpl_base_period == 'decade': + if case.get_value('CALENDAR') == 'NO_LEAP': + basedt = 3600 * 24 * 365 * 10 + else: + expect(False, "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " %ncpl_base_period) + else: + expect(False, "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " %ncpl_base_period) + + if basedt < 0: + expect(False, "basedt invalid overflow for NCPL_BASE_PERIOD %s " %ncpl_base_period) + + comps = case.get_values("COMP_CLASSES") + mindt = basedt + for comp in comps: + ncpl = case.get_value(comp.upper() + '_NCPL') + if ncpl is not None: + cpl_dt = basedt / int(ncpl) + totaldt = cpl_dt * int(ncpl) + if totaldt != basedt: + expect(False, " %s ncpl doesn't divide base dt evenly" %comp) + nmlgen.add_default(comp.lower() + '_cpl_dt', value=cpl_dt) + mindt = min(mindt, cpl_dt) +# elif comp.lower() is not 'cpl': + + #-------------------------------- + # Overwrite: set start_ymd + #-------------------------------- + run_startdate = "".join(str(x) for x in case.get_value('RUN_STARTDATE').split('-')) + nmlgen.set_value('start_ymd', value=run_startdate) + + #-------------------------------- + # Overwrite: set tprof_option and tprof_n - if tprof_total is > 0 + #-------------------------------- + # This would be better handled inside the alarm logic in the driver routines. + # Here supporting only nday(s), nmonth(s), and nyear(s). + + stop_option = case.get_value('STOP_OPTION') + if 'nyear' in stop_option: + tprofoption = 'ndays' + tprofmult = 365 + elif 'nmonth' in stop_option: + tprofoption = 'ndays' + tprofmult = 30 + elif 'nday' in stop_option: + tprofoption = 'ndays' + tprofmult = 1 + else: + tprofmult = 1 + tprofoption = 'never' + + tprof_total = case.get_value('TPROF_TOTAL') + if ((tprof_total > 0) and (case.get_value('STOP_DATE') < 0) and ('ndays' in tprofoption)): + stop_n = case.get_value('STOP_N') + stopn = tprofmult * stop_n + tprofn = int(stopn / tprof_total) + if tprofn < 1: + tprofn = 1 + nmlgen.set_value('tprof_option', value=tprofoption) + nmlgen.set_value('tprof_n' , value=tprofn) + + # Set up the pause_component_list if pause is active + pauseo = case.get_value('PAUSE_OPTION') + if pauseo != 'never' and pauseo != 'none': + pausen = case.get_value('PAUSE_N') + pcl = nmlgen.get_default('pause_component_list') + nmlgen.add_default('pause_component_list', pcl) + # Check to make sure pause_component_list is valid + pcl = nmlgen.get_value('pause_component_list') + if pcl != 'none' and pcl != 'all': + pause_comps = pcl.split(':') + comp_classes = case.get_values("COMP_CLASSES") + for comp in pause_comps: + expect(comp == 'drv' or comp.upper() in comp_classes, + "Invalid PAUSE_COMPONENT_LIST, %s is not a valid component type"%comp) + # End for + # End if + # Set esp interval + if 'nstep' in pauseo: + esp_time = mindt + else: + esp_time = get_time_in_seconds(pausen, pauseo) + + nmlgen.set_value('esp_cpl_dt', value=esp_time) + # End if pause is active + + #-------------------------------- + # (1) Specify input data list file + #-------------------------------- + data_list_path = os.path.join(case.get_case_root(), "Buildconf", "cpl.input_data_list") + if os.path.exists(data_list_path): + os.remove(data_list_path) + + #-------------------------------- + # (2) Write namelist file drv_in and initial input dataset list. + #-------------------------------- + namelist_file = os.path.join(confdir, "drv_in") + drv_namelist_groups = ["ccsm_pes", "papi_inparm", "pio_default_inparm", "prof_inparm", + "seq_cplflds_inparm", "seq_cplflds_userspec", "seq_timemgr_inparm"] + nmlgen.write_output_file(namelist_file, data_list_path=data_list_path, groups=drv_namelist_groups) + + #-------------------------------- + # (3) Write NUOPC config file and add to input dataset list. + #-------------------------------- + + comp_types = ['atm','lnd','ice','ocn','rof','glc','wav','esp'] + stub_types = [ 's' + x for x in comp_types] + xcpl_types = [ 'x' + x for x in comp_types] + data_types = [ 'd' + x for x in comp_types] + + # Determine components that are not present + skip_comps = [] + for item in comp_types: + # stub comps + if case.get_value("COMP_" + item.upper()) == 's' + item: + skip_comps.append(item.upper()) + # data comps + if case.get_value("COMP_" + item.upper()) == 'd' + item: + if item != 'glc': #no glc data component + if case.get_value("D" + item.upper()) == 'NULL' or case.get_value("D" + item.upper()) == 'null': + skip_comps.append(item.upper) + # xcpl_comps + if case.get_value("COMP_" + item.upper()) == 'x' + item: + if item != 'esp': #no esp xcpl component + if case.get_value(item.upper() + "_NX") == "0" and case.get_value(item.upper() + "_NY") == "0": + skip_comps.append(item.upper) + + logger.info("Writing nuopc_runseq will skip components {}".format(skip_comps)) + + #TODO: how would the current data model namelist force_prognostic_true be used - and actually how is it unsed now? + #TODO: how are we going to handle ocnrof_prognostic setting? + + atm_cpl_dt = nmlgen.get_value('atm_cpl_dt') + ocn_cpl_dt = nmlgen.get_value('ocn_cpl_dt') + nuopc_config_file = os.path.join(confdir, "cesm.runconfig") + nmlgen.write_nuopc_config_file(nuopc_config_file, data_list_path=data_list_path, + skip_comps=skip_comps, atm_cpl_dt=atm_cpl_dt, ocn_cpl_dt=ocn_cpl_dt) + + #-------------------------------- + # (4) Write drv_flds_in + #-------------------------------- + # In thte following, all values come simply from the infiles - no default values need to be added + # FIXME - do want to add the possibility that will use a user definition file for drv_flds_in + + caseroot = case.get_value('CASEROOT') + namelist_file = os.path.join(confdir, "drv_flds_in") + nmlgen.add_default('drv_flds_in_files') + drvflds_files = nmlgen.get_default('drv_flds_in_files') + infiles = [] + for drvflds_file in drvflds_files: + infile = os.path.join(caseroot, drvflds_file) + if os.path.isfile(infile): + infiles.append(infile) + + if len(infiles) != 0: + + # First read the drv_flds_in files and make sure that + # for any key there are not two conflicting values + dicts = {} + for infile in infiles: + dict_ = {} + with open(infile) as myfile: + for line in myfile: + if "=" in line and '!' not in line: + name, var = line.partition("=")[::2] + name = name.strip() + var = var.strip() + dict_[name] = var + dicts[infile] = dict_ + + for first,second in itertools.combinations(dicts.keys(),2): + compare_drv_flds_in(dicts[first], dicts[second], first, second) + + # Now create drv_flds_in + config = {} + definition_file = [files.get_value("NAMELIST_DEFINITION_FILE", attribute={"component":"drv_flds-nuopc"})] + nmlgen = NamelistGenerator(case, definition_file, files=files) + skip_entry_loop = True + nmlgen.init_defaults(infiles, config, skip_entry_loop=skip_entry_loop) + drv_flds_in = os.path.join(caseroot, "CaseDocs", "drv_flds_in") + nmlgen.write_output_file(drv_flds_in) + +############################################################################### +def compare_drv_flds_in(first, second, infile1, infile2): +############################################################################### + sharedKeys = set(first.keys()).intersection(second.keys()) + for key in sharedKeys: + if first[key] != second[key]: + print('Key: {}, \n Value 1: {}, \n Value 2: {}'.format(key, first[key], second[key])) + expect(False, "incompatible settings in drv_flds_in from \n %s \n and \n %s" + % (infile1, infile2)) + +############################################################################### +def _create_component_modelio_namelists(case, files): +############################################################################### + # will need to create a new namelist generator + infiles = [] + definition_file = [files.get_value("NAMELIST_DEFINITION_FILE", attribute={"component":"modelio-nuopc"})] + + confdir = os.path.join(case.get_value("CASEBUILD"), "cplconf") + lid = os.environ["LID"] if "LID" in os.environ else get_timestamp("%y%m%d-%H%M%S") + + models = ["cpl", "atm", "lnd", "ice", "ocn", "glc", "rof", "wav", "esp"] + for model in models: + with NamelistGenerator(case, definition_file) as nmlgen: + config = {} + config['component'] = model + entries = nmlgen.init_defaults(infiles, config, skip_entry_loop=True) + + if model == 'cpl': + inst_count = 1 + else: + inst_count = case.get_value("NINST_" + model.upper()) + + inst_index = 1 + while inst_index <= inst_count: + inst_string = inst_index + if inst_index <= 999: + inst_string = "0" + str(inst_string) + if inst_index <= 99: + inst_string = "0" + str(inst_string) + if inst_index <= 9: + inst_string = "0" + str(inst_string) + + # set default values + for entry in entries: + nmlgen.add_default(entry.get("id")) + + # overwrite defaults + moddiri = case.get_value('EXEROOT') + "/" + model + nmlgen.set_value('diri', moddiri) + + moddiro = case.get_value('RUNDIR') + nmlgen.set_value('diro', moddiro) + + if inst_count > 1: + logfile = model + "_" + inst_string + ".log." + str(lid) + else: + logfile = model + ".log." + str(lid) + nmlgen.set_value('logfile', logfile) + + # Write output file + if inst_count > 1: + modelio_file = model + "_modelio.nml_" + str(inst_string) + else: + modelio_file = model + "_modelio.nml" + nmlgen.write_modelio_file(os.path.join(confdir, modelio_file)) + + inst_index = inst_index + 1 + +############################################################################### +def buildnml(case, caseroot, component): +############################################################################### + if component != "drv": + raise AttributeError + + confdir = os.path.join(case.get_value("CASEBUILD"), "cplconf") + if not os.path.isdir(confdir): + os.makedirs(confdir) + + # NOTE: User definition *replaces* existing definition. + # TODO: Append instead of replace? + user_xml_dir = os.path.join(caseroot, "SourceMods", "src.drv") + + expect (os.path.isdir(user_xml_dir), + "user_xml_dir %s does not exist " %user_xml_dir) + + files = Files() + definition_file = [files.get_value("NAMELIST_DEFINITION_FILE", {"component": "drv-nuopc"})] + + user_definition = os.path.join(user_xml_dir, "namelist_definition_drv.xml") + if os.path.isfile(user_definition): + definition_file = [user_definition] + + # Create the namelist generator object - independent of instance + nmlgen = NamelistGenerator(case, definition_file) + + # create cplconf/namelist + infile_text = "" + if case.get_value('COMP_ATM') == 'cam': + # cam is actually changing the driver namelist settings + cam_config_opts = case.get_value("CAM_CONFIG_OPTS") + if "aquaplanet" in cam_config_opts: + infile_text = "aqua_planet = .true. \n aqua_planet_sst = 1" + + # determine infile list for nmlgen + user_nl_file = os.path.join(caseroot, "user_nl_cpl") + namelist_infile = os.path.join(confdir, "namelist_infile") + create_namelist_infile(case, user_nl_file, namelist_infile, infile_text) + infile = [namelist_infile] + + # create the files drv_in, drv_flds_in and seq_maps.rc + _create_drv_namelists(case, infile, confdir, nmlgen, files) + + # create the files comp_modelio.nml where comp = [atm, lnd...] + _create_component_modelio_namelists(case, files) + + # copy drv_in, drv_flds_in, cesm.runconfig and all *modio* fiels to rundir + rundir = case.get_value("RUNDIR") + + shutil.copy(os.path.join(confdir,"drv_in"), rundir) + shutil.copy(os.path.join(confdir,"cesm.runconfig"), rundir) + + drv_flds_in = os.path.join(caseroot, "CaseDocs", "drv_flds_in") + if os.path.isfile(drv_flds_in): + shutil.copy(drv_flds_in, rundir) + + for filename in glob.glob(os.path.join(confdir, "*modelio*")): + shutil.copy(filename, rundir) + +############################################################################### +def _main_func(): + caseroot = parse_input(sys.argv) + + with Case(caseroot) as case: + buildnml(case, caseroot, "drv") + +if __name__ == "__main__": + _main_func() diff --git a/src/drivers/mct/cime_config/cesm.runconfig b/src/drivers/nuopc/cime_config/cesm.runconfig similarity index 81% rename from src/drivers/mct/cime_config/cesm.runconfig rename to src/drivers/nuopc/cime_config/cesm.runconfig index 2f494d367f0..a84a30871b9 100644 --- a/src/drivers/mct/cime_config/cesm.runconfig +++ b/src/drivers/nuopc/cime_config/cesm.runconfig @@ -3,52 +3,44 @@ ######### CESM_component_list: ATM OCN ICE LND ROF MED -#CESM_component_list: ATM OCN ICE ROF MED -#CESM_component_list: ATM OCN MED # MED # MED_model: cesm -#MED_petlist_bounds: _med_petlist_bounds_ MED_attributes:: Verbosity = 0 :: # ATM # ATM_model: datm -#ATM_petlist_bounds: _atm_petlist_bounds_ ATM_attributes:: Verbosity = 0 :: # OCN # OCN_model: docn -#OCN_petlist_bounds: _ocn_petlist_bounds_ OCN_attributes:: Verbosity = 0 :: # ICE # ICE_model: dice -#ICE_petlist_bounds: _ice_petlist_bounds_ ICE_attributes:: Verbosity = 0 :: # ROF # ROF_model: drof -#ROF_petlist_bounds: _rof_petlist_bounds_ ROF_attributes:: Verbosity = 0 :: # LND # LND_model: slnd -#LND_petlist_bounds: _lnd_petlist_bounds_ LND_attributes:: Verbosity = 0 :: -driverAttributes:: +DRIVER_attributes:: Verbosity = 0 Profiling = 0 :: diff --git a/src/drivers/nuopc/cime_config/config_archive.xml b/src/drivers/nuopc/cime_config/config_archive.xml new file mode 100644 index 00000000000..168d40de2d6 --- /dev/null +++ b/src/drivers/nuopc/cime_config/config_archive.xml @@ -0,0 +1,12 @@ + + + \.r\..* + \.h.*.nc$ + unset + + rpointer.cpl + $CASE.cpl.r.$DATENAME.nc + + + + diff --git a/src/drivers/nuopc/cime_config/config_component.xml b/src/drivers/nuopc/cime_config/config_component.xml new file mode 100644 index 00000000000..03e24260943 --- /dev/null +++ b/src/drivers/nuopc/cime_config/config_component.xml @@ -0,0 +1,2629 @@ + + + + + + + + + + char + CPL,ATM,LND,ICE,OCN,ROF,GLC,WAV,ESP + env_case.xml + case_comp + List of component classes supported by this driver + + + + char + cpl + cpl + case_comp + env_case.xml + Name of coupling component + + + + + + + + + char + $CIMEROOT/config_files.xml + case_def + env_case.xml + master configuration file that specifies all relevant filenames + and directories to configure a case + + + + + + + + char + UNSET + case_def + env_case.xml + full pathname of case + + + + char + $CASEROOT/logs + run_desc + env_run.xml + Extra copies of the component log files will be saved here. + + + + char + $CASEROOT/Tools + case_der + env_case.xml + Case Tools directory location (derived variable, not in namelists + + + + char + $CASEROOT/Buildconf + case_der + env_case.xml + Buildconf directory location (derived variable not in namelist) + + + + char + $CIMEROOT/scripts + case_der + env_case.xml + Scripts root directory location (setup automatically to $CIMEROOT/scripts- DO NOT EDIT) + + + + char + UNSET + case_def + env_case.xml + full pathname of CIME source root directory + + + + char + $CIMEROOT/.. + case_def + env_case.xml + full pathname of source root directory + + + + char + $CIMEROOT/scripts/Tools + case_der + env_case.xml + Scripts root utils directory location (setup automatically to $CIMEROOT/scripts/Tools - DO NOT EDIT) + + + + + + + + char + UNSET + case_def + env_case.xml + case name + + + + char + UNSET + run_desc + env_run.xml + case description + + + + char + UNSET + case_last + env_case.xml + Component set long name (for documentation only - DO NOT EDIT) + + + + char + UNSET + build_grid + env_build.xml + Model grid - DO NOT EDIT (for experts only) + + + + char + UNSET + case_def + env_case.xml + current machine name support contact + + + + char + $ENV{USER} + case_desc + env_case.xml + case user name + + + + + + + + char + startup,hybrid,branch + startup + run_begin_stop_restart + env_run.xml + + Determines the model run initialization type. + This setting is only important for the initial run of a production run when the + CONTINUE_RUN variable is set to FALSE. After the initial run, the CONTINUE_RUN + variable is set to TRUE, and the model restarts exactly using input + files in a case, date, and bit-for-bit continuous fashion. + Default: startup. + -- In a startup run (the default), all components are initialized + using baseline states. These baseline states are set independently by + each component and can include the use of restart files, initial + files, external observed data files, or internal initialization (i.e., + a cold start). In a startup run, the coupler sends the start date to + the components at initialization. In addition, the coupler does not + need an input data file. In a startup initialization, the ocean model + does not start until the second ocean coupling (normally the second + day). + -- In a branch run, all components are initialized using a consistent + set of restart files from a previous run (determined by the + RUN_REFCASE and RUN_REFDATE variables in env_run.xml). The case name + is generally changed for a branch run, although it does not have to + be. In a branch run, setting RUN_STARTDATE is ignored because the + model components obtain the start date from their restart datasets. + Therefore, the start date cannot be changed for a branch run. This is + the same mechanism that is used for performing a restart run (where + CONTINUE_RUN is set to TRUE in the env_run.xml) Branch runs are + typically used when sensitivity or parameter studies are required, or + when settings for history file output streams need to be modified + while still maintaining bit-for-bit reproducibility. Under this + scenario, the new case is able to produce an exact bit-for-bit restart + in the same manner as a continuation run IF no source code or + component namelist inputs are modified. All models use restart files + to perform this type of run. RUN_REFCASE and RUN_REFDATE are required + for branch runs. + To set up a branch run, locate the restart tar file or restart + directory for RUN_REFCASE and RUN_REFDATE from a previous run, then + place those files in the RUNDIR directory. + --- In a hybrid run the model is initialized as a startup, BUT uses + initialization datasets FROM A PREVIOUS case. This + is somewhat analogous to a branch run with relaxed restart + constraints. A hybrid run allows users to bring together combinations + of initial/restart files from a previous case (specified by + RUN_REFCASE) at a given model output date (specified by + RUN_REFDATE). Unlike a branch run, the starting date of a hybrid run + (specified by RUN_STARTDATE) can be modified relative to the reference + case. In a hybrid run, the model does not continue in a bit-for-bit + fashion with respect to the reference case. The resulting climate, + however, should be continuous provided that no model source code or + namelists are changed in the hybrid run. In a hybrid initialization, + the ocean model does not start until the second ocean coupling + (normally the second day), and the coupler does a cold start without + a restart file. + + + + + char + ccsm4_init + run_begin_stop_restart + env_run.xml + + Reference directory containing RUN_REFCASE data - used for hybrid or branch runs + + + + + char + case.std + run_begin_stop_restart + env_run.xml + + Reference case for hybrid or branch runs + + + + + char + 0001-01-01 + run_begin_stop_restart + env_run.xml + + Reference date for hybrid or branch runs (yyyy-mm-dd) + + + + + char + 00000 + run_begin_stop_restart + env_run.xml + + Reference time of day (seconds) for hybrid or branch runs (sssss) + + + + + logical + TRUE,FALSE + FALSE + run_begin_stop_restart + env_run.xml + + Flag for automatically prestaging the refcase restart dataset. + If TRUE, then the refcase data is prestaged into the executable directory + + + + + char + 0001-01-01 + run_begin_stop_restart + env_run.xml + + Run start date (yyyy-mm-dd). Only used for startup or hybrid runs. + + + + + integer + 0 + run_begin_stop_restart + env_run.xml + + Run start time-of-day + + + + + char + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,nmonths,nmonth,nyears,nyear,date,ifdays0,end + ndays + run_begin_stop_restart + env_run.xml + + Sets the run length along with STOP_N and STOP_DATE + + + + + integer + 5 + run_begin_stop_restart + env_run.xml + + Provides a numerical count for $STOP_OPTION. + + + + + integer + -999 + run_begin_stop_restart + env_run.xml + + Alternative date yyyymmdd date option, sets the run length with STOP_OPTION and STOP_N + negative value implies off + + + + + char + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,nmonths,nmonth,nyears,nyear,date,ifdays0,end + $STOP_OPTION + run_begin_stop_restart + env_run.xml + + sets frequency of model restart writes (same options as STOP_OPTION) + + + + + integer + $STOP_N + run_begin_stop_restart + env_run.xml + + sets model restart writes with REST_OPTION and REST_DATE + + + + + char + $STOP_DATE + run_begin_stop_restart + env_run.xml + + Alternative date in yyyymmdd format + sets model restart write date with REST_OPTION and REST_N + + + + + char + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,nmonths,nmonth,nyears,nyear + never + run_begin_stop_restart + env_run.xml + + Sets the pause frequency along with PAUSE_N + + + + + integer + 0 + run_begin_stop_restart + env_run.xml + + Provides a numerical count for $PAUSE_OPTION. + + + + + char + none + + cpl + + run_begin_stop_restart + env_run.xml + + A colon-separated list of components to receive pause and resume signals + A value of 'all' means all components will pause and resume + A value of 'none' means that no components will pause or resume + + + + + char + 1 + run_begin_stop_restart + env_run.xml + + sets periodic model barriers with BARRIER_OPTION and BARRIER_DATE for synchronization + + + + + char + -999 + run_begin_stop_restart + env_run.xml + + Alternative date in yyyymmdd format + sets periodic model barriers with BARRIER_OPTION and BARRIER_N for synchronization + + + + + logical + TRUE,FALSE + FALSE + run_begin_stop_restart + env_run.xml + + ESP component runs after driver 'pause cycle' + If any component 'pauses' (see PAUSE_OPTION, PAUSE_N and + PAUSE_COMPONENT_LIST XML variables), the ESP component (if + present) will be run to process the component 'pause' (restart) + files and set any required 'resume' signals. + If true, esp_cpl_dt and esp_cpl_offset settings are ignored. + default: false + + + + + logical + TRUE,FALSE + FALSE + run_begin_stop_restart + env_run.xml + + A setting of TRUE implies a continuation run + When you first begin a branch, hybrid or startup run, CONTINUE_RUN + must be set to FALSE. When you successfully run and get a restart + file, you will need to change CONTINUE_RUN to TRUE for the remainder + of your run. This variable determines if the run is a restart run. + Set to FALSE when initializing a startup, branch or hybrid case. + Set to TRUE when continuing a run. + + + + + integer + 0 + run_begin_stop_restart + env_run.xml + If RESUBMIT is greater than 0, then case will automatically resubmit + Enables the model to automatically resubmit a new run. To get + multiple runs, set RESUBMIT greater than 0, then RESUBMIT will be + decremented and the case will be resubmitted. The case will stop automatically + resubmitting when the RESUBMIT value reaches 0. + Long runs can easily outstrip supercomputer queue time limits. For + this reason, a case is usually run as a series of jobs, each + restarting where the previous finished. + + + + + logical + TRUE + run_begin_stop_restart + env_run.xml + This flag controls whether the RESUBMIT flag causes + CONTINUE_RUN to toggle from FALSE to TRUE. The default is + TRUE. This flag might be used in conjunction with COMP_RUN_BARRIERS for + timing tests. + + + + + logical + run_begin_stop_restart + FALSE + TRUE,FALSE + env_run.xml + Logical to determine whether CESM run has been submitted with the submit script or not + + + + + + + + + logical + TRUE,FALSE + FALSE + run_data_archive + env_run.xml + Logical to turn on short term archiving. + If TRUE, short term archiving will be turned on. + + + + logical + TRUE,FALSE + FALSE + run_data_archive + env_run.xml + Logical to archive all interim restart files, not just those at eor + If TRUE, perform short term archiving on all interim restart files, + not just those at the end of the run. By default, this value is FALSE. + The restart files are saved under the specific component directory + ($DOUT_S_ROOT/$CASE/$COMPONENT/rest rather than the top-level $DOUT_S_ROOT/$CASE/rest directory). + Interim restart files are created using the REST_N and REST_OPTION variables. + This is for expert users ONLY and requires expert knowledge. + We will not document this further in this guide. + + + + integer + 900 + run_data_archive + env_run.xml + system workload snapshot frequency (in seconds, if greater than 0; disabled otherwise) + + + + + + + + char + UNSET + config_batch + env_mach_specific.xml + The environment variables that will be loaded for this machine + + + + char + none + moab,pbs,lsf,slurm,cobalt,cobalt_theta,none + config_batch + env_batch.xml + The batch system type to use for this machine. + + + + char + UNSET + config_batch + env_mach_specific.xml + The individual environment variable entry for config_machines + + + + char + UNSET + config_batch + env_mach_specific.xml + The limits tag + + + + char + UNSET + config_batch + env_mach_specific.xml + The individual limit variable + + + + + + + + char + + build_derived + env_build.xml + Perl 5 library directory + + + + char + + config_batch + env_case.xml + The mpi run command associated with the machine configured batch system + + + + char + UNSET + config_batch + env_case.xml + The module system type defined for this machine + + + + char + UNSET + config_batch + env_case.xml + The module initialization path for module system defined for this machine + + + + char + UNSET + config_batch + env_case.xml + The module command path for module system defined for this machine + + + + + + + + + char + + UNSET + build_def + env_build.xml + Output root directory for each machine. + Base directory for build and run directories. + + + + + char + + $CIME_OUTPUT_ROOT/$CASE/bld + build_def + env_build.xml + Case executable root directory. + (executable is $EXEROOT/$MODEL.exe, component libraries are in $EXEROOT/lib) + This is where the model builds its executable and by default runs the executable. + Note that EXEROOT needs to have enough disk space for the experimental configuration + requirements. As an example, a model run can produce more than a terabyte of + data during a 100-year run, so you should set EXEROOT to scratch or + tmp space and frequently back up the data to a long term archiving storage device + For a supported machine, EXEROOT is set in $CIMEROOT/machines/config_machines.xml. + For a userdefined machine, EXEROOT must explicitly be set it in env_build.xml. + + + + char + + USERDEFINED_required_macros + build_macros + env_build.xml + Operating system - DO NOT EDIT UNLESS for userdefined machine - ignored once Macros has been created. + + + + char + + + build_macros + env_build.xml + Machine compiler (must match one the supported compilers) + Set in $CIMEROOT/machines/config_machines.xml for each supported machine. + Must be explicitly set in env_build.xml for userdefined machine. + + + + char + + + build_def + env_build.xml + email address of person (or group) that supports the build and port for this machine (do not edit)> + + + + char + + USERDEFINED_required_macros + build_macros + env_build.xml + mpi library (must match one of the supported libraries) - + ignored once Macros has been created + Set in $CIMEROOT/machines/config_machines.xml for each supported machine. + Must be explicitly set in env_build.xml for userdefined machine. + + + + char + NO_LEAP,GREGORIAN + NO_LEAP + build_def + env_build.xml + calendar type + + + + char + NUOPC + NUOPC + build_def + env_build.xml + use NUOPC component interface + + + + logical + TRUE + TRUE + build_def + env_build.xml + TRUE implies using the ESMF library specified by ESMF_LIBDIR or ESMFMKFILE + + + + logical + TRUE,FALSE + FALSE + build_def + env_build.xml + TRUE implies turning on run and compile time debugging + Flag to turn on debugging for run time and compile time. + If TRUE, compile-time debugging flags are activated that you can use to verify + software robustness, such as bounds checking. + Important:: On IBM machines, floating point trapping is not activated for production + runs (i.e., non-DEBUG), due to performance penalties associated with turning on these flags. + + + + logical + TRUE,FALSE + FALSE + build_def + env_build.xml + TRUE implies always build model for openmp capability + If FALSE, component libraries are built with OpenMP capability only if + the NTHREADS_ setting for that component is greater than 1 in env_mach_pes.xml. + If TRUE, the component libraries are always built with OpenMP capability. + + + + logical + TRUE,FALSE + FALSE + build_def + env_build.xml + TRUE implies linking to the PETSc library - set + automatically by XXX_USE_PETSC options (do not edit). Flag to turn + on linking to the PETSc library. Currently this is used by + CLM. This is currently only supported for certain machines. + + + + logical + TRUE,FALSE + FALSE + build_def + env_build.xml + TRUE implies linking to the Albany library - set + automatically by XXX_USE_ALBANY options (do not edit). Flag to + turn on linking to the Albany library. Currently this is used by + MPASLI. Note that Albany is a C++ library, so setting this + variable to TRUE will involve the inclusion of C++ code in the + MPASLI executable. This is currently only supported for certain + machines. + + + + logical + TRUE,FALSE + FALSE + build_def + env_build.xml + TRUE implies linking to the trilinos library - set automatically by XXX_USE_TRILINOS options (do not edit) + Flag to turn on linking to the trilinos library. Currently this is + used by CISM. Note that trilinos is a C++ library, so setting this + variable to TRUE will involve the inclusion of C++ code in the model + executable. This is currently only supported for certain machines. + + + + char + + gmake + build_def + env_build.xml + GNU make command + + + + integer + + 1 + build_def + env_build.xml + Number of processors for gmake + + + + logical + TRUE,FALSE + FALSE + build_status + env_build.xml + Status output: if TRUE, models have been built successfully. (DO NOT EDIT)> + + + + char + + 0 + build_status + env_build.xml + Status: smp status of previous build, coded string. (DO NOT EDIT) + + + + char + + 0 + build_status + env_build.xml + Status: smp status of current case, coded string (DO NOT EDIT) + + + + char + + 0 + build_status + env_build.xml + Status: ninst status of previous build, coded string. (DO NOT EDIT)> + + + + char + + 0 + build_status + env_build.xml + Status: ninst status of current case, coded string (DO NOT EDIT) + + + + integer + 0,1,2 + 0 + build_status + env_build.xml + Status: of prior build. (DO NOT EDIT) + + + + char + + $EXEROOT + build_derived + env_build.xml + case build directory (set automatically to $EXEROOT, - DO NOT EDIT) + + + + char + + $EXEROOT/lib + build_derived + env_build.xml + case lib directory (set automatically to $EXEROOT/lib - DO NOT EDIT) + + + + char + + $EXEROOT/lib/include + build_derived + env_build.xml + case lib include directory (set automatically to $EXEROOT/lib/include - DO NOT EDIT) + + + + char + + $EXEROOT + build_derived + env_build.xml + Shared library root, (set automatically to $EXEROOT - DO NOT EDIT) + + + + + + + + logical + TRUE,FALSE + TRUE + run_flags + env_run.xml + logical to diagnose model timing at the end of the run + + + + + integer + 12 + run_flags + env_run.xml + timer output depth + + + + char + + timing + run_flags + env_run.xml + Where to auto archive timing data + + + + logical + TRUE,FALSE + FALSE + run_cesm + env_run.xml + Enables the papi hardware counters in gptl + The papi library must be included in the build step for + this to work. + + + + char + ESMF_LOGKIND_SINGLE,ESMF_LOGKIND_MULTI,ESMF_LOGKIND_NONE + ESMF_LOGKIND_NONE + run_cesm + env_run.xml + + Determines what ESMF log files (if any) are generated when + USE_ESMF_LIB is TRUE. + ESMF_LOGKIND_SINGLE: Use a single log file, combining messages from + all of the PETs. Not supported on some platforms. + ESMF_LOGKIND_MULTI: Use multiple log files -- one per PET. + ESMF_LOGKIND_NONE: Do not issue messages to a log file. + By default, no ESMF log files are generated. + + + + + logical + TRUE,FALSE + FALSE + run_flags + env_run.xml + Turns on component barriers for component timing. + This variable is for testing and debugging only and should never + be set for a production run. + + + + + integer + 0 + mach_pes_last + env_mach_pes.xml + pes or cores used relative to PES_PER_NODE for accounting (0 means TOTALPES is valid) + + + + + + + + char + UNSET + build_grid + env_build.xml + atmosphere grid - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of atmosphere cells in i direction - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of atmosphere cells in j direction - DO NOT EDIT (for experts only) + + + + char + UNSET + build_grid + env_build.xml + land grid - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of land cells in i direction - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of land cells in j direction - DO NOT EDIT (for experts only) + + + + char + UNSET + build_grid + env_build.xml + ocn grid - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of ocn cells in i direction - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of ocn cells in j direction - DO NOT EDIT (for experts only) + + + + char + UNSET + build_grid + env_build.xml + ice grid (must equal ocn grid) - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of ice cells in i direction - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of ice cells in j direction - DO NOT EDIT (for experts only) + + + + integer + 1 + build_grid + env_build.xml + number of ice thickness categories - DO NOT EDIT (set by CICE configure) + + + + char + UNSET + build_grid + env_build.xml + river runoff (rof) grid + + + + integer + 0 + build_grid + env_build.xml + number of rof cells in i direction - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of rof cells in j direction - DO NOT EDIT (for experts only) + + + + char + gland20,gland10,gland5,gland5UM,gland4,mpas.gis20km,mpas.ais20km,null + gland5UM + build_grid + env_build.xml + glacier (glc) grid - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of glc cells in i direction - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of glc cells in j direction - DO NOT EDIT (for experts only) + + + + + char + UNSET + build_grid + env_build.xml + wave model (wav) grid + + + + integer + 0 + build_grid + env_build.xml + number of wav cells in i direction - DO NOT EDIT (for experts only) + + + + integer + 0 + build_grid + env_build.xml + number of wav cells in j direction - DO NOT EDIT (for experts only) + + + + char + UNSET + build_grid + env_build.xml + grid mask - DO NOT EDIT (for experts only) + + + + logical + TRUE,FALSE + FALSE + run_domain + env_run.xml + Operate on only a single point of the global grid - DO NOT EDIT (for experts only) + + + + real + -999.99 + run_domain + env_run.xml + Latitude to find nearest points for points mode (only used if PTS_MODE is TRUE) + + + + real + -999.99 + run_domain + env_run.xml + Longitude to find nearest points for points mode (only used if PTS_MODE is TRUE) + + + + + + + + char + UNSET + run_domain + env_run.xml + atm domain file + + + + char + $DIN_LOC_ROOT/share/domains + run_domain + env_run.xml + path of atm domain file + + + + char + UNSET + run_domain + env_run.xml + lnd domain file + + + + char + $DIN_LOC_ROOT/share/domains + run_domain + env_run.xml + path of lnd domain file + + + + char + UNSET + run_domain + env_run.xml + rof domain file + + + + char + $DIN_LOC_ROOT/share/domains + run_domain + env_run.xml + path of rof domain file + + + + char + UNSET + run_domain + env_run.xml + wav domain file + + + + char + $DIN_LOC_ROOT/share/domains + run_domain + env_run.xml + path of wav domain file + + + + char + UNSET + run_domain + env_run.xml + ice domain file + + + + char + $DIN_LOC_ROOT/share/domains + run_domain + env_run.xml + path of ice domain file + + + + char + UNSET + run_domain + env_run.xml + ocn domain file + + + + char + $DIN_LOC_ROOT/share/domains + run_domain + env_run.xml + path of ocn domain file + + + + char + UNSET + run_domain + env_run.xml + glc domain file + + + + char + $DIN_LOC_ROOT/share/domains + run_domain + env_run.xml + path of glc domain file + + + + + + + char + idmap + run_domain + env_run.xml + atm2ocn flux mapping file + + + + char + X,Y + X + run_domain + env_run.xml + atm2ocn flux mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + atm2ocn state mapping file + + + + char + X,Y + X + run_domain + env_run.xml + atm2ocn state mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + atm2ocn vector mapping file + + + + char + X,Y + X + run_domain + env_run.xml + atm2ocn vector mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + atm2lnd flux mapping file + + + + char + X,Y + X + run_domain + env_run.xml + atm2lnd flux mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + atm2lnd state mapping file + + + + char + X,Y + X + run_domain + env_run.xml + atm2lnd state mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + atm2wav state mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + atm2wav state mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + ocn2atm flux mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + ocn2atm flux mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + ocn2atm state mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + ocn2atm state mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + lnd2atm flux mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + lnd2atm flux mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + lnd2atm state mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + lnd2atm state mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + lnd2glc flux mapping file + + + + char + X,Y + X + run_domain + env_run.xml + lnd2glc flux mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + lnd2glc state mapping file + + + + char + X,Y + X + run_domain + env_run.xml + lnd2glc state mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + lnd2rof flux mapping file + + + + char + X,Y + X + run_domain + env_run.xml + lnd2rof flux mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + rof2lnd flux mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + rof2lnd flux mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + rof2ocn flux mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + rof2ocn flux mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + rof2ocn runoff mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + rof2ocn runoff mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + rof2ocn runoff mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + rof2ocn runoff mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + glc2lnd flux mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + glc2lnd flux mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + glc2lnd state mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + glc2lnd state mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + glc2ice runoff mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + glc2ice runoff mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + glc2ocn runoff mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + glc2ocn runoff mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + ocn2wav state mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + ocn2wav state mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + ice2wav state mapping file + + + + char + X,Y + Y + run_domain + env_run.xml + ice2wav state mapping file decomp type + + + + char + idmap + run_domain + env_run.xml + wav2ocn state mapping file + + + + char + X,Y + X + run_domain + env_run.xml + wav2ocn state mapping file decomp type + + + + char + none,npfix,cart3d,cart3d_diag,cart3d_uvw,cart3d_uvw_diag + cart3d + run_domain + env_run.xml + vector mapping option + + + + char + 1.0e-02 + run_domain + env_run.xml + Error tolerance for differences in fractions in domain checking + + + + real + 9.0e-07 + run_domain + env_run.xml + Error tolerance for differences in atm/land areas in domain checking + + + + real + 1.0e-13 + run_domain + env_run.xml + Error tolerance for differences in atm/land masks in domain checking + + + + real + 1.0e-12 + run_domain + env_run.xml + Error tolerance for differences in atm/land lat/lon in domain checking + + + + real + 1.0e-01 + run_domain + env_run.xml + Error tolerance for differences in ocean/ice lon/lat in domain checking + + + + real + 1.0e-06 + run_domain + env_run.xml + Error tolerance for differences in ocean/ice lon/lat in domain checking + + + + real + 1.0e-02 + run_domain + env_run.xml + Error tolerance for differences in ocean/ice lon/lat in domain checking + + + + + + + + char + UNSET + case_def + env_case.xml + Machine name + + + + char + + case_def + env_case.xml + Machines directory location + + + + char + $CIME_OUTPUT_ROOT/$CASE/run + run_desc + env_run.xml + + The directory where the executable will be run. + By default this is set to EXEROOT/../run. + RUNDIR allows you to keep the run directory separate from the build directory + + + + + char + UNSET + run_din + env_run.xml + + A regular expression to match machine node names to ACME machine. + + + + + char + run_din + env_run.xml + + A regular expression to search for an indication that a run failure was caused by a node failure + and should therefore be re-attempted. + + + + + char + UNSET + run_din + env_run.xml + + Proxy (if any) setting for http_proxy to allow web access on this machine. + + + + + logical + FALSE + run_din + env_run.xml + + Indicates to case.submit that this is a test case. + + + + + char + UNSET + run_din + env_run.xml + + The root directory of all CIME and component input data for the selected machine. + This is usually a shared disk area. + Default values for the target machine are in the + $CIMEROOT/machines/config_machines.xml + + + + + char + UNSET + run_din + env_run.xml + CLM-specific root directory for CLM type input forcing data + This directory will only be used for I (CLM/DATM) compsets and only + for datm forcing data that is NOT checked into the svn repository + (datasets other than the Qian or single-point forcing). + This is usually a shared disk area. + Default values for the target machine are in the + $CIMEROOT/machines/config_machines.xml + + + + char + UNSET + run_dout + env_run.xml + Root directory for short term archiving. This directory must be visible to compute nodes. + + + + char + UNSET + run_mpi + env_run.xml + override the mpi run command, do not include model executable + + + + + + + + integer + 0 + mach_pes + env_mach_pes.xml + Percent of extra spare nodes to allocate + + + + integer + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + mach_pes + env_mach_pes.xml + number of tasks for each component + + + + integer + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + mach_pes + env_mach_pes.xml + number of threads for each task in each component + + + + integer + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + mach_pes + env_mach_pes.xml + ROOTPE (mpi task in MPI_COMM_WORLD) for each component + + + + integer + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + mach_pes + env_mach_pes.xml + Number of instances for each component + + + + char + sequential,concurrent + + concurrent + concurrent + concurrent + concurrent + concurrent + concurrent + concurrent + concurrent + + mach_pes + env_mach_pes.xml + Layout of component instances for each component + + + + integer + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + mach_pes + env_mach_pes.xml + Number of instances for each component + + + + integer + 0 + mach_pes_last + env_mach_pes.xml + total number of tasks and threads (setup automatically - DO NOT EDIT) + + + + integer + 0 + mach_pes_last + env_mach_pes.xml + maximum number of tasks/ threads allowed per node + + + + integer + 0 + mach_pes_last + env_mach_pes.xml + pes or cores per node for accounting purposes + + + + + + + + integer + 1 + 1,2 + build_macros + env_build.xml + PIO library version + + + + char + + build_macros + env_build.xml + PIO configure options, see PIO configure utility for details + + + + logical + TRUE,FALSE + FALSE + run_pio + env_run.xml + TRUE implies perform asynchronous i/o + + + + char + p2p,coll,default + p2p + run_pio + env_run.xml + pio rearranger communication type + + + + char + 2denable,io2comp,comp2io,disable,default + 2denable + run_pio + env_run.xml + pio rearranger communication flow control direction + + + + integer + + 0 + run_pio + env_run.xml + pio rearranger communication max pending requests (comp2io) : 0 implies that CIME internally calculates the value ( = max(64, 2 * PIO_NUMTASKS) ), -1 implies no bound on max pending requests + + + + logical + TRUE,FALSE + TRUE + run_pio + env_run.xml + pio rearranger communiation options (comp2io) : TRUE implies enable handshake + + + + logical + TRUE,FALSE + FALSE + run_pio + env_run.xml + pio rearranger communiation options (comp2io) : TRUE implies enable isend + + + + integer + + 64 + run_pio + env_run.xml + pio rearranger communication max pending requests (io2comp) : -1 implies no bound on max pending requests + + + + + + logical + TRUE,FALSE + FALSE + run_pio + env_run.xml + pio rearranger communiation options (io2comp) : TRUE implies enable handshake + + + + logical + TRUE,FALSE + TRUE + run_pio + env_run.xml + pio rearranger communiation options (io2comp) : TRUE implies enable isend + + + + + integer + 0 + run_pio + env_run.xml + pio debug level + + + + integer + -1 + run_pio + env_run.xml + pio blocksize for box decompositions + + + + integer + -1 + run_pio + env_run.xml + pio buffer size limit for pnetcdf output + + + + char + netcdf,pnetcdf,netcdf4p,netcdf4c,default + run_pio + env_run.xml + pio io type + + default + default + default + default + default + default + default + default + default + + + + + integer + run_pio + env_run.xml + + stride in compute comm of io tasks for each component, if this value is -99 it will + be computed based on PIO_NUMTASKS and number of compute tasks + + + + + + + + + + + + + + + + integer + 1,2 + run_pio + env_run.xml + pio rearranger choice box=1, subset=2 + + $PIO_VERSION + + + + + + + + + + + + + + integer + run_pio + env_run.xml + pio root processor relative to component root + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + + + integer + run_pio + env_run.xml + + pio number of io tasks, if this value is -99 it will be computed based on PIO_STRIDE and + number of tasks + + + -99 + -99 + -99 + -99 + -99 + -99 + -99 + -99 + -99 + + + + + + + + + char + UNSET + test + env_test.xml + Test type name + + + + char + UNSET + test + env_test.xml + Test type descriptor + + + + char + UNSET + test + env_test.xml + Testcase short name + + + + char + UNSET + test + env_test.xml + Case base ID + + + + logical + TRUE,FALSE + TRUE + test + env_test.xml + Is first run of test + + + + char + UNSET + test + env_test.xml + Arguments supplied to create_test + + + + char + UNSET + test + env_test.xml + supplied or computed test id + + + + real + 0.10 + test + env_test.xml + Expected relative memory usage growth for test + + + + logical + TRUE,FALSE + FALSE + test + env_test.xml + Whether to generate a baseline + + + + logical + TRUE,FALSE + FALSE + test + env_test.xml + Whether to compare the baseline + + + + char + UNSET + test + env_test.xml + The tagname we are comparing baselines against + + + + char + UNSET + test + env_test.xml + The tagname we are comparing baselines against + + + + char + /UNSET + test + env_test.xml + The directory where baselines are stored + + + + char + UNSET + test + env_test.xml + The tagname we are generating baselines for + + + + char + UNSET + test + env_test.xml + The tagname we are comparing baselines against + + + + logical + TRUE,FALSE + FALSE + test + env_test.xml + Whether to clean the test after it is built/run + + + + char + UNSET + test + env_test.xml + standard full pathname of the cprnc executable + + + + char + UNSET + user_mods + env_case.xml + path to user mods under TESTS_MODS_DIR or USER_MODS_DIR + + + + + + + + logical + TRUE,FALSE + FALSE + run_coupling + env_run.xml + determine if per ice thickness category fields are passed from ice to ocean - DO NOT EDIT (set by POP build-namelist) + + + + + + + + char + + never + run_drv_history + env_run.xml + Sets driver snapshot history file frequency (like REST_OPTION) + + + + integer + + -999 + run_drv_history + env_run.xml + Sets driver snapshot history file frequency (like REST_N) + + + + + integer + + -999 + run_drv_history + env_run.xml + yyyymmdd format, sets coupler snapshot history date (like REST_DATE) + + + + integer + 0,1,2,3,4,5,6 + 0 + run_flags + env_run.xml + Coupler decomposition option. + + + + integer + 0,1,2,3 + 1 + run_flags + env_run.xml + level of debug output, 0=minimum, 1=normal, 2=more, 3=too much + + + + logical + TRUE,FALSE + FALSE + build_component_clm + env_build.xml + TRUE implies CLM is built with support for the PETSc + library. The Variably Saturated Flow Model (VSFM) solver in CLM + uses the PETSc library. In order to use the VSFM solver, CLM + must be built with PETSc support and linking to PETSc must occur + when building the ACME executable. This occurs if this variable + is set to TRUE. Note that is only available on a limited set of + machines/compilers. + + + + char + + + build_component_mpasli + env_build.xml + MPASLI configure options. Currently not used + + + + logical + TRUE,FALSE + FALSE + build_component_mpasli + env_build.xml + TRUE implies MPASLI is built with support for the Albany + library The first-order velocity solver in MPASLI uses the + Albany library. In order to use that velocity solver, MPASLI + must be built with Albany support and linking to Albany must + occur when building the ACME executable. This occurs if this + variable is set to TRUE. Note that is only available on a + limited set of machines/compilers. This must remain FALSE to + run MPASLI on a machine that does not have Albany, or for which + the CIME scripts are not aware of the existence of + Albany. + + + + + + char + + external_tools + env_run.xml + External script to be run before model completion + + + char + + external_tools + env_run.xml + External script to be run after model completion + + + + + + logical + TRUE,FALSE + FALSE + external_tools + env_run.xml + Run the external tool pointed to by DATA_ASSIMILATION_SCRIPT after the model run completes + + + integer + + 1 + external_tools + env_run.xml + Number of model run - data assimilation steps to complete + + + char + + + external_tools + env_run.xml + External script to be run after model completion + + + + + char + + + job_submission + env_batch.xml + The machine queue in which to submit the job. Default determined in config_machines.xml can be overwritten by testing + + + + char + + + job_submission + env_batch.xml + The machine wallclock setting. Default determined in config_machines.xml can be overwritten by testing + + + + char + + + job_submission + env_batch.xml + Override the batch submit command this job. Do not include executable or dependencies + + + + char + + job_submission + env_batch.xml + project for project-sensitive build and run paths, and job scripts + + + + char + unknown + case_der + env_case.xml + Apparent version of the model used for this case + + + + + logical + TRUE,FALSE + FALSE + job_submission + env_batch.xml + whether the PROJECT value is required on this machine + + + + ========================================= + Notes: + (1) Time period is first four characters of + compset name + ========================================= + + + diff --git a/src/drivers/nuopc/cime_config/config_component_acme.xml b/src/drivers/nuopc/cime_config/config_component_acme.xml new file mode 100644 index 00000000000..b4b93da3b51 --- /dev/null +++ b/src/drivers/nuopc/cime_config/config_component_acme.xml @@ -0,0 +1,738 @@ + + + + + + + + logical + TRUE,FALSE + TRUE + run_flags + env_run.xml + Turns on component varying thread control in the driver. + Used to set the driver namelist variable "drv_threading". + + + + logical + TRUE,FALSE + TRUE + run_flags + env_run.xml + logical to save timing files in rundir + + + + integer + 20 + run_flags + env_run.xml + timer output depth + + + + integer + 12 + run_flags + env_run.xml + timer detail FIXME - add documentation + + + + logical + TRUE,FALSE + TRUE + run_flags + env_run.xml + turns on coupler bit-for-bit reproducibility with varying pe counts + + + + char + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,nmonths,nmonth,nyears,nyear,date,ifdays0,end + never + + ndays + + run_begin_stop_restart + env_run.xml + + sets frequency of full model barrier (same options as STOP_OPTION) for synchronization with BARRIER_N and BARRIER_DATE + + + + + real + + 284.7 + + 367.0 + 367.0 + + run_co2 + env_run.xml + + Mechanism for setting the CO2 value in ppmv for CLM if + CLM_CO2_TYPE is constant POP if OCN_CO2_TYPE is constant. + + + + + logical + TRUE,FALSE + FALSE + + TRUE + TRUE + + run_flags + env_run.xml + Turn on the passing of water isotope fields through the coupler + + + + char + minus1p8,linear_salt,mushy + minus1p8 + run_physics + env_run.xml + Freezing point calculation for salt water. + + + + BGC CO2=prog, rad CO2=prog: + BGC CO2=diag, rad CO2=diag: + ECO in POP: + --DO NOT USE FOR LONG SIMULATIONS: + pre-industrial: + present day: + Historical 1850 to 2000 transient: + AMIP for stand-alone cam: + CCMI REFC2 1950 to 2100 transient: + CCMI REFC2 2004 to 2100 transient: + 1948 to 2004 transient: + CCMI REFC1 Free running, 1950 to 2010 transient: + CCMI REFC1 Specified dynamics, 1975 to 2010 transient: + RCP8.5 future scenario: + RCP6.0 future scenario: + RCP4.5 future scenario: + 1955 to 2005 transient: + RCP8.5 future scenario: + RCP6.0 future scenario: + RCP4.5 future scenario: + RCP2.6 future scenario: + RCP4.5 based scenario from 2013 (control for WACCM/CARMA nuclear winter study): + 1992 to 2005 transient: + prescribed meteorology: for stand-alone cam + ARM95 IOP: for stand-alone cam + ARM97 IOP: for stand-alone cam + CLM transient land use: + + pre-industrial (1850) to present day: + -----------------------------WARNING ------------------------------------------------ + "PIPD" compsets use complete forcing data from observed sources + up to the year 2005. Following this period they are a combination of observed sources + (land-use, SST, sea ice, CO2, CH4, N2O) to present day and IPCC RCP4.5 scenario data. + ------------------------------------------------------------------------------------- + + + -----------------------------WARNING ------------------------------------------------ + This compset is not spun-up! In later versions of the model, spun-up initial + conditions will be provided and this warning will be removed. + ------------------------------------------------------------------------------------- + + + + + + + + + char + CESM1_ORIG,CESM1_ORIG_TIGHT,CESM1_MOD,CESM1_MOD_TIGHT,RASM_OPTION1,RASM_OPTION2 + CESM1_MOD_TIGHT + + CESM1_MOD + CESM1_MOD + CESM1_MOD + CESM1_MOD + CESM1_MOD + CESM1_MOD + CESM1_MOD + RASM_OPTION1 + + run_coupling + env_run.xml + + Coupler sequencing option. This is used to set the driver namelist variable cpl_seq_option. + CESM1_ORIG is the cesm1.1 implementation. + CESM1_MOD includes a cesm1.3 mod that swaps ocean merging and atm/ocn flux + computation. + RASM_OPTION1 runs prep ocean before the ocean coupling reducing + most of the lags and field inconsistency but still allowing the ocean to run + concurrently with the ice and atmosphere. + RASM_OPTION2 is similar to RASM_OPTION1 + but sequences the ice model, prep ocean and ocean model in that order. The + ocean model loses some of the concurrency with the ice model. + CESM1_ORIG_TIGHT and CESM1_MOD_TIGHT are consistent with the old variables + ocean_tight_coupling = true in the driver. That namelist is gone and the + cpl_seq_option flags take it's place. + TIGHT coupling makes no sense with the OPTION5 and OPTION6 flags. + + + + + char + none,CO2A,CO2B,CO2C,CO2_DMSA + none + + CO2A + none + CO2C + CO2C + CO2A + CO2A + CO2A + + run_coupling + env_run.xml + Flag to turn on new fields in coupling. + If the value is not none, the coupler is compiled so that optional + BGC related fields are exchanged between component models. + + + + + char + hour,day,year,decade + run_coupling + env_run.xml + day + + year + year + day + hour + day + day + day + day + + Base period associated with NCPL coupling frequency. + This xml variable is only used to set the driver namelist variables, + atm_cpl_dt, lnd_cpl_dt, ocn_cpl_dt, ice_cpl_dt, glc_cpl_dt, rof_cpl_dt, wav_cpl_dt, and esp_dt. + + + + integer + 48 + + 48 + 48 + 48 + 48 + 144 + 288 + 288 + 48 + 48 + 72 + 48 + 4 + 24 + 24 + 24 + 1 + 1 + 1 + 24 + 48 + 12 + 96 + 96 + 12 + 12 + 96 + 96 + 144 + 144 + 96 + 144 + 144 + 72 + 144 + 288 + 48 + 48 + 24 + 24 + 1 + 4 + 4 + + run_coupling + env_run.xml + Number of atm coupling intervals per NCPL_BASE_PERIOD. + This is used to set the driver namelist atm_cpl_dt, equal to basedt/ATM_NCPL, + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + integer + $ATM_NCPL + + 1 + 1 + 1 + 24 + 48 + $ATM_NCPL + 12 + 96 + + run_coupling + env_run.xml + Number of land coupling intervals per NCPL_BASE_PERIOD. + This is used to set the driver namelist atm_cpl_dt, equal to basedt/LND_NCPL, + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + integer + $ATM_NCPL + + 1 + 1 + 1 + 24 + 48 + $ATM_NCPL + 12 + 96 + + run_coupling + env_run.xml + Number of ice coupling intervals per NCPL_BASE_PERIOD. + This is used to set the driver namelist ice_cpl_dt, equal to basedt/ICE_NCPL + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + integer + $ATM_NCPL + + 1 + 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 24 + 48 + $ATM_NCPL + 12 + 48 + 96 + + run_coupling + env_run.xml + Number of ocn coupling intervals per NCPL_BASE_PERIOD. + Thisn is used to set the driver namelist ocn_cpl_dt, equal to basedt/OCN_NCPL + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + integer + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + run_coupling + env_run.xml + Number of glc coupling intervals per NCPL_BASE_PERIOD. + + + + char + glc_coupling_period,yearly + glc_coupling_period + run_coupling + env_run.xml + Period at which coupler averages fields sent to GLC. + This supports doing the averaging to GLC less frequently than GLC is called + (i.e., separating the averaging frequency from the calling frequency). + This is useful because there are benefits to only averaging the GLC inputs + as frequently as they are really needed (yearly for CISM), but GLC needs to + still be called more frequently than that in order to support mid-year restarts. + + Setting GLC_AVG_PERIOD to 'glc_coupling_period' means that the averaging is + done exactly when the GLC is called (governed by GLC_NCPL). + + + + + integer + 8 + + 6 + 6 + $ATM_NCPL + $ATM_NCPL + $ATM_NCPL + $ATM_NCPL + $ATM_NCPL + $ATM_NCPL + 1 + 1 + 1 + 24 + 8 + 6 + 4 + 8 + + run_coupling + env_run.xml + Number of rof coupling intervals per NCPL_BASE_PERIOD. + This is used to set the driver namelist rof_cpl_dt, equal to basedt/ROF_NCPL + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + integer + $ATM_NCPL + run_coupling + env_run.xml + Number of wav coupling intervals per NCPL_BASE_PERIOD. + This is used to set the driver namelist wav_cpl_dt, equal to basedt/WAV_NCPL + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + + + logical + TRUE,FALSE + FALSE + + TRUE + TRUE + TRUE + + run_component_cpl + env_run.xml + + Only used for compsets with DATM and POP (currently C, G and J): + If true, compute albedos to work with daily avg SW down + If false (default), albedos are computed with the assumption that downward + solar radiation from the atm component has a diurnal cycle and zenith-angle + dependence. This is normally the case when using an active atm component + If true, albedos are computed with the assumption that downward + solar radiation from the atm component is a daily average quantity and + does not have a zenith-angle dependence. This is often the case when + using a data atm component. Only used for compsets with DATM and POP (currently C, G and J). + NOTE: This should really depend on the datm forcing and not the compset per se. + So, for example, whether it is set in a J compset should depend on + what datm forcing is used. + + + + + char + off,ocn + off + + ocn + + run_component_cpl + env_run.xml + + Only used for compsets with DATM and POP (currently C, G and J): + If ocn, ocn provides EP balance factor for precipitation. + Provides EP balance factor for precip for POP. A factor computed by + POP is applied to precipitation so that precipitation balances + evaporation and ocn global salinity does not drift. This is intended + for use when coupling POP to a DATM. Only used for C, G and J compsets. + Default is off + + + + + char + + never + + nmonths + + run_drv_history + env_run.xml + Sets driver average history file frequency (like REST_OPTION) + + + + char + + -999 + + 1 + + run_drv_history + env_run.xml + Sets driver average history file frequency (like REST_N) + + + + integer + + -999 + run_drv_history + env_run.xml + yyyymmdd format, sets driver average history date (like REST_DATE) + + + + logical + TRUE,FALSE + FALSE + + TRUE + TRUE + TRUE + + run_budgets + env_run.xml + logical that turns on diagnostic budgets for driver + + + + real + + 379.000 + + 284.7 + 284.7 + 284.7 + 0.000001 + 0.000001 + 367.0 + 379.000 + 284.7 + 379.000 + 379.000 + 367.0 + 367.0 + 367.0 + 367.0 + 367.0 + 367.0 + 367.0 + 379.000 + 0.000001 + 0.000001 + 0.000001 + 0.000001 + 0.000001 + 0.000001 + 0.000001 + 0.000001 + 0.000001 + 0.000001 + 368.9 + 368.9 + 367.0 + 284.725 + 284.725 + 368.865 + 368.865 + 368.865 + 368.865 + 368.865 + 368.865 + 368.865 + + 0.000001 + 0.000001 + + 284.7 + 368.9 + 0.000001 + 0.000001 + 0.000001 + 0.000001 + 0.000001 + 0.000001 + + run_co2 + env_run.xml + This set the namelist values of CO2 ppmv for CAM and CLM. This variables is + introduced to coordinate this value among multiple components. + + + + char + on, off + off + case_def + env_case.xml + If set to off, this component set/ grid specification is not scientifically supported. + If set to on, this component set/ grid specification is scientifically supported + + + + integer + + 0 + + + -3 + -3 + -1 + 1 + 1 + -1 + 1 + -2 + -2 + -5 + -5 + -6 + 0 + 0 + 0 + 0 + 1 + 3 + 1 + 3 + 1 + 3 + 3 + 3 + 3 + 1 + 2 + 2 + 2 + 1 + 1 + + case_cost + env_case.xml + 2**n relative cost of compset where B is 1 (DO NOT EDIT) + + + + integer + 0,1,3,5,10,36 + 10 + + 0 + + run_glc + env_run.xml + Glacier model number of elevation classes, 0 implies no glacier land unit in clm + Used by both CLM and CISM (even if CISM is not running, and only SGLC is used). + + + + logical + TRUE,FALSE + FALSE + + TRUE + TRUE + TRUE + + TRUE + + run_glc + env_run.xml + Whether the glacier component feeds back to the rest of the system + This affects: + (1) Whether CLM updates its areas based on glacier areas sent from GLC + (2) Whether GLC sends fluxes (e.g., calving fluxes) to the coupler + Note that this is set to TRUE by default for TG compsets - even though there are + no feedbacks for TG compsets, this enables extra coupler diagnostics for these + compsets. + + + + integer + + 0 + case_cost + env_case.xml + 2**n relative cost of grid where f19_g15 is 1 (DO NOT EDIT) + + + + integer + + 0 + case_cost + env_case.xml + 2**n relative cost of machine (DO NOT EDIT) + + + + BGC CO2=prog, rad CO2=prog: + BGC CO2=diag, rad CO2=diag: + ECO in POP: + --DO NOT USE FOR LONG SIMULATIONS: + pre-industrial: + present day: + Historical 1850 to 2000 transient: + Historical 1850 to 2000 transient: + AMIP for stand-alone cam: + CCMI REFC2 1950 to 2100 transient: + CCMI REFC2 2004 to 2100 transient: + 1948 to 2004 transient: + CCMI REFC1 Free running, 1950 to 2010 transient: + CCMI REFC1 Specified dynamics, 1975 to 2010 transient: + RCP8.5 future scenario: + RCP6.0 future scenario: + RCP4.5 future scenario: + 1955 to 2005 transient: + RCP8.5 future scenario: + RCP6.0 future scenario: + RCP4.5 future scenario: + RCP2.6 future scenario: + RCP4.5 based scenario from 2013 (control for WACCM/CARMA nuclear winter study): + 1992 to 2005 transient: + GEOS5 meteorology: for stand-alone cam + ARM95 IOP: for stand-alone cam + ARM97 IOP: for stand-alone cam + CLM transient land use: + CLM transient land use: + + pre-industrial (1850) to present day: + -----------------------------WARNING ------------------------------------------------ + "PIPD" compsets use complete forcing data from observed sources + up to the year 2005. Following this period they are a combination of observed sources + (land-use, SST, sea ice, CO2, CH4, N2O) to present day and IPCC RCP4.5 scenario data. + ------------------------------------------------------------------------------------- + + + -----------------------------WARNING ------------------------------------------------ + This compset is not spun-up! In later versions of the model, spun-up initial + conditions will be provided and this warning will be removed. + ------------------------------------------------------------------------------------- + + + + diff --git a/src/drivers/nuopc/cime_config/config_component_cesm.xml b/src/drivers/nuopc/cime_config/config_component_cesm.xml new file mode 100644 index 00000000000..fd3123165d8 --- /dev/null +++ b/src/drivers/nuopc/cime_config/config_component_cesm.xml @@ -0,0 +1,502 @@ + + + + + + + + logical + TRUE,FALSE + FALSE + run_flags + env_run.xml + Turns on component varying thread control in the driver. + Used to set the driver namelist variable "drv_threading". + + + + logical + TRUE,FALSE + FALSE + run_flags + env_run.xml + logical to save timing files in rundir + + + + integer + 0 + run_cesm + env_run.xml + Determines number of times profiler is called over the model run period. + This sets values for tprof_option and tprof_n that determine the timing output file frequency + + + + + integer + 2 + run_flags + env_run.xml + timer output depth + + + + logical + TRUE,FALSE + FALSE + run_flags + env_run.xml + turns on coupler bit-for-bit reproducibility with varying pe counts + + + + char + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,nmonths,nmonth,nyears,nyear,date,ifdays0,end + never + + ndays + + run_begin_stop_restart + env_run.xml + + sets frequency of full model barrier (same options as STOP_OPTION) for synchronization with BARRIER_N and BARRIER_DATE + + + + + char + none,CO2A,CO2B,CO2C,CO2_DMSA + none + + CO2A + none + CO2A + CO2C + CO2C + CO2A + CO2A + + run_coupling + env_run.xml + Flag to turn on new fields in coupling. + If the value is not none, the coupler is compiled so that optional + BGC related fields are exchanged between component models. + + + + + char + hour,day,year,decade + run_coupling + env_run.xml + day + + year + hour + + Base period associated with NCPL coupling frequency. + This xml variable is only used to set the driver namelist variables, + atm_cpl_dt, lnd_cpl_dt, ocn_cpl_dt, ice_cpl_dt, glc_cpl_dt, rof_cpl_dt, wav_cpl_dt, and esp_dt. + + + + integer + 48 + + 48 + 144 + 288 + 288 + 48 + 48 + 72 + 48 + 4 + 24 + 24 + 24 + 48 + 1 + 96 + 96 + 96 + 96 + 72 + 144 + 288 + 48 + 48 + 24 + 24 + 1 + 4 + 4 + + run_coupling + env_run.xml + Number of atm coupling intervals per NCPL_BASE_PERIOD. + This is used to set the driver namelist atm_cpl_dt, equal to basedt/ATM_NCPL, + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + integer + $ATM_NCPL + + 1 + + run_coupling + env_run.xml + Number of land coupling intervals per NCPL_BASE_PERIOD. + This is used to set the driver namelist atm_cpl_dt, equal to basedt/LND_NCPL, + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + integer + $ATM_NCPL + + 1 + + run_coupling + env_run.xml + Number of ice coupling intervals per NCPL_BASE_PERIOD. + This is used to set the driver namelist ice_cpl_dt, equal to basedt/ICE_NCPL + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + integer + $ATM_NCPL + + 1 + 4 + 24 + 24 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + run_coupling + env_run.xml + Number of ocn coupling intervals per NCPL_BASE_PERIOD. + Thisn is used to set the driver namelist ocn_cpl_dt, equal to basedt/OCN_NCPL + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + integer + 1 + + 1 + + run_coupling + env_run.xml + Number of glc coupling intervals per NCPL_BASE_PERIOD. + + + + char + glc_coupling_period,yearly + yearly + run_coupling + env_run.xml + Period at which coupler averages fields sent to GLC. + This supports doing the averaging to GLC less frequently than GLC is called + (i.e., separating the averaging frequency from the calling frequency). + This is useful because there are benefits to only averaging the GLC inputs + as frequently as they are really needed (yearly for CISM), but GLC needs to + still be called more frequently than that in order to support mid-year restarts. + + Setting GLC_AVG_PERIOD to 'glc_coupling_period' means that the averaging is + done exactly when the GLC is called (governed by GLC_NCPL). + + IMPORTANT: In order to restart mid-year when running with CISM, you MUST specify GLC_AVG_PERIOD = 'yearly'. + If using GLC_AVG_PERIOD = 'glc_coupling_period' with CISM, you can only restart on year boundaries. + + + + + integer + 8 + + $ATM_NCPL + $ATM_NCPL + $ATM_NCPL + 8 + $ATM_NCPL + 1 + + run_coupling + env_run.xml + Number of rof coupling intervals per NCPL_BASE_PERIOD. + This is used to set the driver namelist rof_cpl_dt, equal to basedt/ROF_NCPL + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + integer + $ATM_NCPL + run_coupling + env_run.xml + Number of wav coupling intervals per NCPL_BASE_PERIOD. + This is used to set the driver namelist wav_cpl_dt, equal to basedt/WAV_NCPL + where basedt is equal to NCPL_BASE_PERIOD in seconds. + + + + + + logical + TRUE,FALSE + FALSE + + TRUE + TRUE + FALSE + + run_component_cpl + env_run.xml + + Only used for compsets with DATM and POP (currently C, G and J): + If true, compute albedos to work with daily avg SW down + If false (default), albedos are computed with the assumption that downward + solar radiation from the atm component has a diurnal cycle and zenith-angle + dependence. This is normally the case when using an active atm component + If true, albedos are computed with the assumption that downward + solar radiation from the atm component is a daily average quantity and + does not have a zenith-angle dependence. This is often the case when + using a data atm component. Only used for compsets with DATM and POP (currently C, G and J). + NOTE: This should really depend on the datm forcing and not the compset per se. + So, for example, whether it is set in a J compset should depend on + what datm forcing is used. + + + + + char + off,ocn + off + + ocn + off + + run_component_cpl + env_run.xml + + Only used for compsets with DATM and POP (currently C, G and J): + If ocn, ocn provides EP balance factor for precipitation. + Provides EP balance factor for precip for POP. A factor computed by + POP is applied to precipitation so that precipitation balances + evaporation and ocn global salinity does not drift. This is intended + for use when coupling POP to a DATM. Only used for C, G and J compsets. + Default is off + + + + + char + CESM1_ORIG,CESM1_ORIG_TIGHT,CESM1_MOD,CESM1_MOD_TIGHT,RASM_OPTION1,RASM_OPTION2 + CESM1_MOD_TIGHT + + CESM1_MOD + CESM1_MOD + RASM_OPTION1 + RASM_OPTION1 + CESM1_MOD + CESM1_MOD + CESM1_MOD + CESM1_MOD + + run_coupling + env_run.xml + + Coupler sequencing option. This is used to set the driver namelist variable cpl_seq_option. + CESM1_ORIG is the cesm1.1 implementation. + CESM1_MOD includes a cesm1.3 mod that swaps ocean merging and atm/ocn flux + computation. + RASM_OPTION1 runs prep ocean before the ocean coupling reducing + most of the lags and field inconsistency but still allowing the ocean to run + concurrently with the ice and atmosphere. + RASM_OPTION2 is similar to RASM_OPTION1 + but sequences the ice model, prep ocean and ocean model in that order. The + ocean model loses some of the concurrency with the ice model. + CESM1_ORIG_TIGHT and CESM1_MOD_TIGHT are consistent with the old variables + ocean_tight_coupling = true in the driver. That namelist is gone and the + cpl_seq_option flags take it's place. + TIGHT coupling makes no sense with the OPTION5 and OPTION6 flags. + + + + + char + + never + + nmonths + + run_drv_history + env_run.xml + Sets driver average history file frequency (like REST_OPTION) + + + + char + + -999 + + 1 + + run_drv_history + env_run.xml + Sets driver average history file frequency (like REST_N) + + + + integer + + -999 + run_drv_history + env_run.xml + yyyymmdd format, sets driver average history date (like REST_DATE) + + + + logical + TRUE,FALSE + FALSE + + TRUE + TRUE + TRUE + + run_budgets + env_run.xml + logical that turns on diagnostic budgets for driver + + + + real + + 284.7 + + 367.0 + 284.7 + + run_co2 + env_run.xml + + Mechanism for setting the CO2 value in ppmv for + CLM if CLM_CO2_TYPE is constant or for + POP if OCN_CO2_TYPE is constant. + + + + + logical + TRUE,FALSE + FALSE + + TRUE + TRUE + + run_flags + env_run.xml + Turn on the passing of water isotope fields through the coupler + + + + integer + 0,1,3,5,10,36 + 10 + + 0 + + run_glc + env_run.xml + Glacier model number of elevation classes, 0 implies no glacier land unit in clm + Used by both CLM and CISM (even if CISM is not running, and only SGLC is used). + + + + logical + TRUE,FALSE + FALSE + + TRUE + TRUE + + TRUE + + run_glc + env_run.xml + Whether the glacier component feeds back to the rest of the system + This affects: + (1) Whether CLM updates its areas based on glacier areas sent from GLC + (2) Whether GLC sends fluxes (e.g., calving fluxes) to the coupler + Note that this is set to TRUE by default for TG compsets - even though there are + no feedbacks for TG compsets, this enables extra coupler diagnostics for these + compsets. + + + + char + minus1p8,linear_salt,mushy + mushy + run_physics + env_run.xml + Freezing point calculation for salt water. + + + + BGC CO2=prog, rad CO2=prog: + BGC CO2=diag, rad CO2=diag: + ECO in POP: + --DO NOT USE FOR LONG SIMULATIONS: + pre-industrial: + present day: + Historical 1850 to 2000 transient: + AMIP for stand-alone cam: + CCMI REFC2 1950 to 2100 transient: + CCMI REFC2 2004 to 2100 transient: + 1948 to 2004 transient: + CCMI REFC1 Free running, 1950 to 2010 transient: + CCMI REFC1 Specified dynamics, 1975 to 2010 transient: + RCP8.5 future scenario: + RCP6.0 future scenario: + RCP4.5 future scenario: + 1955 to 2005 transient: + RCP8.5 future scenario: + RCP6.0 future scenario: + RCP4.5 future scenario: + RCP2.6 future scenario: + RCP4.5 based scenario from 2013 (control for WACCM/CARMA nuclear winter study): + 1992 to 2005 transient: + prescribed meteorology: for stand-alone cam + ARM95 IOP: for stand-alone cam + ARM97 IOP: for stand-alone cam + CLM transient land use: + + pre-industrial (1850) to present day: + -----------------------------WARNING ------------------------------------------------ + "PIPD" compsets use complete forcing data from observed sources + up to the year 2005. Following this period they are a combination of observed sources + (land-use, SST, sea ice, CO2, CH4, N2O) to present day and IPCC RCP4.5 scenario data. + ------------------------------------------------------------------------------------- + + + -----------------------------WARNING ------------------------------------------------ + This compset is not spun-up! In later versions of the model, spun-up initial + conditions will be provided and this warning will be removed. + ------------------------------------------------------------------------------------- + + + + diff --git a/src/drivers/nuopc/cime_config/config_compsets.xml b/src/drivers/nuopc/cime_config/config_compsets.xml new file mode 100644 index 00000000000..dd42eada95d --- /dev/null +++ b/src/drivers/nuopc/cime_config/config_compsets.xml @@ -0,0 +1,108 @@ + + + + + + ========================================= + compset naming convention + ========================================= + The compset longname below has the specified order + atm, lnd, ice, ocn, river, glc wave esp cesm-options + + The notation for the compset longname below is + TIME_ATM[%phys]_LND[%phys]_ICE[%phys]_OCN[%phys]_ROF[%phys]_GLC[%phys]_WAV[%phys][_ESP][_BGC%phys] + + The following compsets are those that can be tested in CIME stand-alone configurations + without any prognostic components. + For the compsets below the following are the only allowable values of the components. + + TIME = Time period (e.g. 2000, HIST, RCP8...) + ATM = [DATM, SATM, XATM] + LND = [DLND, SLND, XLND] + ICE = [DICE, SICE, XICE] + OCN = [DOCN, SOCN, XOCN] + ROF = [DROF, SROF, XROF] + GLC = [ SGLC ] + WAV = [DWAV, SWAV ] + ESP = [DESP, SESP ] + + The OPTIONAL %phys attributes specify submodes of the given system + For example DOCN%DOM is the data ocean model for DOCN + ALL the possible %phys choices for each component are listed + with the -list command for create_newcase + ALL data models must have a %phys option that corresponds to the data model mode + + Each compset node is associated with the following elements + - lname + - alias + - support (optional description of the support level for this compset) + Each compset node can also have the following attributes + - grid (optional regular expression match for grid to work with the compset) + + + + AA + 2000_DATM%NYF_DLND%LCPL_DICE%SSMI_DOCN%DOM_DROF%NYF_SGLC_DWAV + + + + A + 2000_DATM%NYF_SLND_DICE%SSMI_DOCN%DOM_DROF%NYF_SGLC_SWAV + + + + ADSOM + 2000_DATM%NYF_SLND_DICE%SSMI_DOCN%SOM_DROF%NYF_SGLC_SWAV_TEST + + + + ADSOMAQP + 2000_DATM%NYF_SLND_SICE_DOCN%SOMAQP_SROF_SGLC_SWAV + + + + ADAQP3 + 2000_DATM%NYF_SLND_SICE_DOCN%AQP3_SROF_SGLC_SWAV + + + + ADAQPFILE + 2000_DATM%NYF_SLND_SICE_DOCN%AQPFILE_SROF_SGLC_SWAV + + + + ADLND + 2000_SATM_DLND%SCPL_SICE_SOCN_SROF_SGLC_SWAV + + + + ADWAV + 2000_SATM_SLND_SICE_SOCN_SROF_SGLC_DWAV%CLIMO + + + + ADESP + 2000_DATM%NYF_SLND_DICE%SSMI_DOCN%DOM_DROF%NYF_SGLC_SWAV_DESP + + + + ADESP_TEST + 2000_DATM%NYF_SLND_DICE%SSMI_DOCN%DOM_DROF%NYF_SGLC_SWAV_DESP%TEST + + + + AIAF + 2000_DATM%IAF_SLND_DICE%IAF_DOCN%IAF_DROF%IAF_SGLC_SWAV + + + + S + 2000_SATM_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP + + + + X + 2000_XATM_XLND_XICE_XOCN_XROF_XGLC_XWAV + + + diff --git a/src/drivers/nuopc/cime_config/config_pes.xml b/src/drivers/nuopc/cime_config/config_pes.xml new file mode 100644 index 00000000000..e6236321213 --- /dev/null +++ b/src/drivers/nuopc/cime_config/config_pes.xml @@ -0,0 +1,211 @@ + + + + + + + + none + + -1 + -1 + -1 + -1 + -1 + -1 + -1 + -1 + -1 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + none + + 60 + 60 + 60 + 60 + 60 + 60 + 60 + 60 + 60 + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + none + + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 4 + 20 + 12 + 8 + 0 + 16 + 24 + 24 + 24 + + + + + + + + + none + + -8 + -8 + -8 + -8 + -8 + -8 + -8 + -8 + -8 + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 1 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + none + + -1 + -1 + -1 + -1 + -1 + -1 + -1 + -1 + -1 + + + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + diff --git a/src/drivers/nuopc/cime_config/namelist_definition_drv.xml b/src/drivers/nuopc/cime_config/namelist_definition_drv.xml new file mode 100644 index 00000000000..d061ae52397 --- /dev/null +++ b/src/drivers/nuopc/cime_config/namelist_definition_drv.xml @@ -0,0 +1,4258 @@ + + + + + + + + + + + + + + char + nuopc + nuopc_var + + ATM OCN ICE LND ROF MED + + + + + char + nuopc + DRIVER_attributes + + 0 + + + + + + + char + nuopc + DRIVER_attributes + + 0 + + + + + char + nuopc + nuopc_var + + cesm + + + + + char + nuopc + MED_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_ATM + + + + + char + nuopc + ATM_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_OCN + + + + + char + nuopc + OCN_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_ICE + + + + + char + nuopc + ICE_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_ROF + + + + + char + nuopc + ROF_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_LND + + + + + char + nuopc + LND_attributes + + 0 + + + + + + + + + char + nuopc_attribute + nuopc_runseq + + + @ocn_cpl_dt #ocean coupling step + MED med_phases_prep_ocn + MED med_connectors_prep_med2ocn + MED -> OCN :remapMethod=redist + OCN + @atm_cpl_dt # atmosphere coupling step + MED med_phases_prep_ice + MED med_connectors_prep_med2ice + MED -> ICE :remapMethod=redist + MED med_phases_prep_lnd + MED med_connectors_prep_med2lnd + MED -> LND :remapMethod=redist + MED med_phases_prep_rof + MED med_connectors_prep_med2rof + MED -> ROF :remapMethod=redist + ICE + LND + ROF + ROF -> MED :remapMethod=redist + MED med_connectors_post_rof2med + LND -> MED :remapMethod=redist + MED med_connectors_post_lnd2med + ICE -> MED :remapMethod=redist + MED med_connectors_post_ice2med + MED med_phases_prep_atm + MED med_connectors_prep_med2atm + MED -> ATM :remapMethod=redist + ATM + ATM -> MED :remapMethod=redist + MED med_connectors_post_atm2med + MED med_phases_accum_fast + @ + OCN -> MED :remapMethod=redist + MED med_connectors_post_ocn2med + @ + + + + + + + + + + + char + expdef + DRIVER_info_attributes + acme,cesm + cime model + + cesm + acme + + + + + logical + expdef + DRIVER_info_attributes + + true => turn on aquaplanet mode in cam + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + + 1 => default sst mode for aquaplanet in cam + + + 1 + + + + + char + expdef + DRIVER_info_attributes + + case name. + + + $CASE + + + + + char + expdef + DRIVER_info_attributes + + case description. + + + $CASESTR + + + + + + + char + expdef + DRIVER_info_attributes + + username documentation + + + $USER + + + + + char + expdef + DRIVER_info_attributes + + hostname information, + + + $MACH + + + + + char + expdef + DRIVER_info_attributes + + location of timing output. + + + ./timing + + + + + char + expdef + DRIVER_info_attributes + + location of timing checkpoint output. + + + ./timing/checkpoints + + + + + char + expdef + DRIVER_info_attributes + startup,branch,continue + + mode to start the run up, [startup,branch,continue], + automatically derived from RUN_TYPE in env_run.xml + + + startup + startup + branch + continue + continue + continue + + + + + logical + expdef + DRIVER_info_attributes + + Allow same branch casename as reference casename. If $CASE and $REFCASE are the same and the start_type is + not startup, then the value of brnch_retain_casename is set to .true. + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + + Level of debug output, 0=minimum, 1=normal, 2=more, 3=too much (default: 1) + + + $INFO_DBUG + + + + + logical + expdef + DRIVER_info_attributes + + turns on bfb option in coupler which produce bfb results in the + coupler on different processor counts. (default: .false.) + + + $BFBFLAG + + + + + char + orbital + DRIVER_info_attributes + fixed_year,variable_year,fixed_parameters + + orbital model setting. this sets how the orbital mode will be + configured. + "fixed_year" uses the orb_iyear and other orb inputs are ignored. In + this mode, the orbital parameters are constant and based on the year. + "variable_year" uses the orb_iyear and orb_iyear_align. In this mode, + the orbital parameters vary as the model year advances and the model + year orb_iyear_align has the equivalent orbital year of orb_iyear. + "fixed_parameters" uses the orb_eccen, orb_mvelp, and orb_obliq to set + the orbital parameters which then remain constant through the model + integration. [fixed_year, variable_year, fixed_parameters] (default: 'fixed_year'.) + + + fixed_year + + + + + integer + orbital + DRIVER_info_attributes + + model year associated with orb_iyear when orb_mode is variable_year. (default: 1990) + + + 1990 + + + + + integer + orbital + DRIVER_info_attributes + + year of orbit, used when orb_mode is fixed_year or variable_year. (default: 1990) + + + 1990 + + + + + real + orbital + DRIVER_info_attributes + + eccentricity of orbit, used when orb_mode is fixed_parameters. + default: SHR_ORB_UNDEF_REAL (1.e36) (Not currently used in build-namelist) + + + 1.e36 + + + + + real + orbital + DRIVER_info_attributes + + location of vernal equinox in longitude degrees, used when orb_mode is fixed_parameters. + default: SHR_ORB_UNDEF_REAL (1.e36)(Not currently used in build-namelist) + + + 1.e36 + + + + + real + orbital + DRIVER_info_attributes + + obliquity of orbit in degrees, used when orb_mode is fixed_parameters. + default: SHR_ORB_UNDEF_REAL (1.e36) (Not currently used in build-namelist) + + + 1.e36 + + + + + char + wv_sat + DRIVER_info_attributes + GoffGratch,MurphyKoop,Bolton,Flatau + + Type of water vapor saturation vapor pressure scheme employed. 'GoffGratch' for + Goff and Gratch (1946); 'MurphyKoop' for Murphy and Koop (2005); 'Bolton' for + Bolton (1980); 'Flatau' for Flatau, Walko, and Cotton (1992). + Default: GoffGratch + + + GoffGratch + + + + + real + wv_sat + DRIVER_info_attributes + + Width of the liquid-ice transition range in mixed-phase water saturation vapor + pressure calculations. The range always ends at 0 degrees Celsius, so this + variable only affects the start of the transition. + Default: 20K + WARNING: CAM is tuned to the default value of this variable. Because it affects + so many different parameterizations, changes to this variable may require a + significant retuning of CAM's cloud physics to give reasonable results. + + + 20.0D0 + + + + + logical + wv_sat + DRIVER_info_attributes + + Whether or not to produce lookup tables at init time to use as a cache for + saturation vapor pressure. + Default: .false. + + + .false. + + + + + real + wv_sat + DRIVER_info_attributes + + Temperature resolution of saturation vapor pressure lookup tables in Kelvin. + (This is only used if wv_sat_use_tables is .true.) + Default: 1.0 + + + 1.0D0 + + + + + char + control + DRIVER_info_attributes + Freezing point calculation for salt water. + + $TFREEZE_SALTWATER_OPTION + + + + + char + control + DRIVER_info_attributes + off,ocn + + Only used for C,G compsets: if ocn, ocn provides EP balance factor for precip + + + $CPL_EPBAL + + + + + logical + control + DRIVER_info_attributes + + Only used for C,G compsets: if true, compute albedos to work with daily avg SW down + + + $CPL_ALBAV + + + + + char + control + DRIVER_info_attributes + on,off,on_if_glc_coupled_fluxes + + Whether to renormalize the surface mass balance (smb) sent from lnd to glc so that the + global integral on the glc grid agrees with the global integral on the lnd grid. + + Unlike most fluxes, smb is remapped with bilinear rather than conservative mapping weights, + so this option is needed for conservation. However, conservation is not required in many + cases, since we often run glc as a diagnostic (one-way-coupled) component. + + Allowable values are: + 'on': always do this renormalization + 'off': never do this renormalization (see WARNING below) + 'on_if_glc_coupled_fluxes': Determine at runtime whether to do this renormalization. + Does the renormalization if we're running a two-way-coupled glc that sends fluxes + to other components (which is the case where we need conservation). + Does NOT do the renormalization if we're running a one-way-coupled glc, or if + we're running a glc-only compset (T compsets). + (In these cases, conservation is not important.) + + Only used if running with a prognostic GLC component. + + WARNING: Setting this to 'off' will break conservation when running with an + evolving, two-way-coupled glc. + + + on_if_glc_coupled_fluxes + + + + + real + control + DRIVER_info_attributes + + Wall time limit for run + default: -1.0 + + + -1.0 + + + + + char + control + DRIVER_info_attributes + day,month,year + + Force stop at the next month, day, etc when wall_time_limit is hit + default: month + + + month + + + + + logical + control + DRIVER_info_attributes + + If true, turn on diurnal cycle in computing atm/ocn fluxes + default: false + + + .false. + + + + + real + control + DRIVER_info_attributes + + wind gustiness factor + + + 0.0D0 + + + + + char + mapping + DRIVER_info_attributes + + ATM_GRID values passed into driver. + + + $ATM_GRID + + + + + char + mapping + DRIVER_info_attributes + + LND_GRID values passed into driver. + + + $LND_GRID + + + + + char + mapping + DRIVER_info_attributes + + OCN_GRID values passed into driver. + + + $OCN_GRID + + + + + char + mapping + DRIVER_info_attributes + + ICE_GRID values passed into driver. + + + $ICE_GRID + + + + + char + mapping + DRIVER_info_attributes + + ROF_GRID values passed into driver. + + + $ROF_GRID + + + + + char + mapping + DRIVER_info_attributes + + GLC_GRID values passed into driver. + + + $GLC_GRID + + + + + char + mapping + DRIVER_info_attributes + + WAV_GRID values passed into driver. + + + $WAV_GRID + + + + + logical + mapping + DRIVER_info_attributes + + invoke pole averaging corrections in shr_map_mod weights generation (default: true) + + + .true. + + + + + char + mapping + DRIVER_info_attributes + none,npfix,cart3d,cart3d_diag,cart3d_uvw,cart3d_uvw_diag + + vect_map + turns on the vector mapping option for u and v vector mapping between + atm and ocean grids in the coupler. the options are none, npfix, + cart3d, cart3d_diag, cart3d_uvw, and cart3d_uvw_diag. the none option + results in scalar mapping independently for the u and v field which + tends to generate large errors near the poles. npfix is the + traditional option where the vectors are corrected on the ocean grid + north of the last latitude line of the atmosphere grid. the cart3d + options convert the east (u) and north (v) vectors to 3d (x,y,z) + triplets, and maps those fields before converting back to the east (u) + and north (v) directions. the cart3d ignores the resuling "w" + velocity. the cart3d_uvw calculates the resulting u and v vectors by + preserving the total "u,v,w" speed and the angle of the (u,v) vector. + the _diag options just add diagnotics to the log file about the vector + mapping. + + + $VECT_MAP + + + + + char + mapping + DRIVER_info_attributes + ocn,atm,exch + + Grid for atm ocn flux calc (untested) + default: ocn + + + ocn + + + + + logical + mapping + DRIVER_info_attributes + + mct alltoall mapping flag + default: false + + + .false. + + + + + logical + mapping + DRIVER_info_attributes + + mct vector flag + default: false + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + 0,1,2,3,4,5,6 + + cpl decomp option (0=default, 1=comp decomp, 2=rearr comp decomp, 3=new single 1d seg + default: 0 + + + $CPL_DECOMP + + + + + char + expdef + DRIVER_info_attributes + CESM1_ORIG,CESM1_MOD,CESM1_ORIG_TIGHT,CESM1_MOD_TIGHT,RASM_OPTION1,RASM_OPTION2 + + Set the coupler sequencing. + + + $CPL_SEQ_OPTION + + + + + logical + expdef + DRIVER_info_attributes + + default: true + + + .true. + + + + + logical + budget + DRIVER_info_attributes + + logical that turns on diagnostic budgets, false means budgets will never be written + + + $BUDGETS + + + + + logical + history + DRIVER_info_attributes + + logical to write an extra initial coupler history file + + + .false. + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the instantaneous budgets. [0,1,2,3], + written only if BUDGETS variable is true + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 0 + + + 0 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the daily budgets. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 0 + + + 0 + + + + + integer + expdef + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the monthy budgets. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 1 + + + 1 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the annual budgets. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 1 + + + 1 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the longterm budgets written at the end + of the year. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets, + default: 1 + + + 1 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the longterm budgets written at the end + of each run. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets, + default: 0 + + + 0 + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for instantaneous atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 1-hour average atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 1-hour instantaneous atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 3-hour average atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 3-hour average atm to coupler precip fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for daily average atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for instantaneous land to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for instantaneous runoff to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for annual sno to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + writes atm fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes lnd fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes ocn fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes ice fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes rof fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes glc fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes wav fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes xao fields in coupler average history files. + default: true + + + .true. + + + + + logical + performance + DRIVER_info_attributes + + turn on run time control of threading per pe per component by the driver + default: false + + + $DRV_THREADING + + + + + logical + performance + DRIVER_info_attributes + + default: .false. + + + $COMP_RUN_BARRIERS + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in fractions in domain checking + default: 1.0e-02 + + + $EPS_FRAC + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in atm/land masks in domain checking + default: 1.0e-13 + + + $EPS_AMASK + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in atm/land lat/lon in domain checking + default: 1.0e-12 + + + $EPS_AGRID + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in atm/land areas in domain checking + default: 1.0e-07 + + + $EPS_AAREA + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in ocean/ice masks in domain checking + default: 1.0e-06 + + + $EPS_OMASK + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in ocean/ice lon/lat in domain checking + default: 1.0e-2 + + + $EPS_OGRID + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in ocean/ice lon/lat in domain checking + default: 1.0e-1 + + + $EPS_OAREA + + + + + logical + DRIVER_info_attributes + DRIVER_info_attributes + + turns on single column mode. set by PTS_MODE in env_case.xml, default: false + + + .false. + .true. + + + + + real + DRIVER_info_attributes + DRIVER_info_attributes + + grid point latitude associated with single column mode. + if set to -999, ignore this value + + + -999. + $PTS_LAT + + + + + real + DRIVER_info_attributes + DRIVER_info_attributes + + grid point longitude associated with single column mode. + set by PTS_LON in env_run.xml. + + + -999. + $PTS_LON + + + + + logical + reprosum + DRIVER_info_attributes + + Use faster method for reprosum, but one where reproducibility is not always guaranteed. + default: .false. + + + .false. + + + + + real + reprosum + DRIVER_info_attributes + + Tolerance for relative error + default: -1.0e-8 + + + -1.0e-8 + + + + + logical + reprosum + DRIVER_info_attributes + + Recompute with non-scalable algorithm if reprosum_diffmax is exceeded. + default: .false. + + + .false. + + + + + char + expdef + DRIVER_info_attributes + + Model version + + + unknown + + + + + char + expdef + DRIVER_info_attributes + + Driver restart pointer file. + + + rpointer.drv + + + + + char + expdef + DRIVER_info_attributes + + Full archive path to restart file + + + str_undefined + + + + + char + expdef + DRIVER_info_attributes + + Ending suffix "postfix" for output log files. + + + .log + + + + + char + expdef + DRIVER_info_attributes + + Root for output log files. + + + ./ + + + + + logical + expdef + DRIVER_info_attributes + + Perpetual flag + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + + Perpetual date + + + -999 + + + + + real + expdef + DRIVER_info_attributes + + Abort if cplstep time exceeds this value + + + 0. + + + + + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ocn flux mapping file for fluxes + + + $ATM2OCN_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ocn state mapping file for states + + + $ATM2OCN_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ocn state mapping file for velocity + + + $ATM2OCN_VMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_VMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ocn to atm mapping file for fluxes + + + $OCN2ATM_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ocn to atm mapping file for states + + + $OCN2ATM_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ice flux mapping file for fluxes + + + $ATM2OCN_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ice state mapping file for states + + + $ATM2OCN_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ice state mapping file for velocity + + + $ATM2OCN_VMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_VMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ice to atm mapping file for fluxes + + + $OCN2ATM_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ice to atm mapping file for states + + + $OCN2ATM_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to land mapping file for fluxes + + + $ATM2LND_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2LND_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to land mapping file for states + + + $ATM2LND_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2LND_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to atm mapping file for fluxes + + + $LND2ATM_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2ATM_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to atm mapping file for states + + + $LND2ATM_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2ATM_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + lnd to runoff conservative mapping file + + + $LND2ROF_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2ROF_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to lnd conservative mapping file + + + $ROF2LND_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2LND_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to ocn area overlap conservative mapping file + + + $ROF2OCN_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2OCN_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to ocn runoff conservative mapping file + + + $GLC2OCN_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2OCN_RMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to ice runoff conservative mapping file + + + $GLC2ICE_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2ICE_RMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to ocn nearest neighbor plus smoothing conservative mapping file + + + $ROF2OCN_LIQ_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2OCN_LIQ_RMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to ocn nearest neighbor plus smoothing conservative mapping file + + + $ROF2OCN_ICE_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2OCN_ICE_RMAPTYPE + X + + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to glc mapping file for fluxes + + + $LND2GLC_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2GLC_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to glc mapping file for states + + + $LND2GLC_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2GLC_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to land mapping file for fluxes + + + $GLC2LND_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2LND_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to land mapping file for states + + + $GLC2LND_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2LND_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to wav state mapping file for states + + + $ATM2WAV_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2WAV_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ocn to wav state mapping file for states + + + $OCN2WAV_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2WAV_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ice to wav state mapping file for states + + + $ICE2WAV_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ICE2WAV_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + wav to ocn state mapping file for states + + + $WAV2OCN_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $WAV2OCN_SMAPTYPE + X + + + + + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x history fields + + + Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x precipitation history output every 3 hours + + + Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x history output every 24 hours + + + Faxa_bcphiwet:Faxa_bcphodry:Faxa_bcphidry:Faxa_ocphiwet:Faxa_ocphidry:Faxa_ocphodry:Faxa_dstwet1:Faxa_dstdry1:Faxa_dstwet2:Faxa_dstdry2:Faxa_dstwet3:Faxa_dstdry3:Faxa_dstwet4:Faxa_dstdry4:Sa_co2prog:Sa_co2diag + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x instantaneous history output every hour + + + Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x averaged history output every hour + + + Sa_u:Sa_v + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x averaged history output every 3 hours + + + Sa_z:Sa_topo:Sa_u:Sa_v:Sa_tbot:Sa_ptem:Sa_shum:Sa_dens:Sa_pbot:Sa_pslv:Faxa_lwdn:Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl:Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf:Sa_co2diag:Sa_co2prog + + + + + + + + + logical + seq_flds + seq_cplflds_inparm + + Previously, new fields that were needed to be passed between components + for certain compsets were specified by cpp-variables. This has been + modified to now be use cases. This use cases are specified in the + namelist cpl_flds_inparm and are currently triggered by the xml variable CCSM_BGC. + If CCSM_BGC is set to 'CO2A', then flds_co2a will be set to .true. + + + .false. + .true. + + + + + logical + seq_flds + seq_cplflds_inparm + + Previously, new fields that were needed to be passed between components + for certain compsets were specified by cpp-variables. This has been + modified to now be use cases. This use cases are specified in the + namelist cpl_flds_inparm and are currently triggered by the xml variable CCSM_BGC. + If CCSM_BGC is set to 'CO2B', then flds_co2b will be set to .true. + + + .false. + .true. + + + + + logical + seq_flds + seq_cplflds_inparm + + Previously, new fields that were needed to be passed between components + for certain compsets were specified by cpp-variables. This has been + modified to now be use cases. This use cases are specified in the + namelist cpl_flds_inparm and are currently triggered by the xml variable CCSM_BGC. + If CCSM_BGC is set to 'CO2C', then flds_co2c will be set to .true. + + + .false. + .true. + + + + + logical + seq_flds + seq_cplflds_inparm + + Previously, new fields that were needed to be passed between components + for certain compsets were specified by cpp-variables. This has been + modified to now be use cases. This use cases are specified in the + namelist cpl_flds_inparm and are currently triggered by the xml variable CCSM_BGC. + If CCSM_BGC is set to 'CO2_DMSA', then flds_co2_dmsa will be set to .true. + + + .false. + .true. + + + + + logical + seq_flds + seq_cplflds_inparm + + Previously, new fields that were needed to be passed between components + for certain compsets were specified by cpp-variables. This has been + modified to now be use cases. This use cases are specified in the + namelist cpl_flds_inparm and are currently triggered by the xml variable ACME_BGC. + This is a new master switch for turning ACME BGC off and on, just for testing. + If ACME_BGC is set to 'TRUE', then flds_bgc will be set to .true. + + + .false. + + + + + logical + seq_flds + seq_cplflds_inparm + + Pass water isotopes between components + + + $FLDS_WISO + + + + + integer + seq_flds + seq_cplflds_inparm + + Number of cism elevation classes. Set by the xml variable GLC_NEC in env_run.xml + + + $GLC_NEC + + + + + integer + seq_flds + seq_cplflds_inparm + + Number of sea ice thickness categories. Set by the xml variable ICE_NCAT in env_build.xml + + + $ICE_NCAT + + + + + logical + seq_flds + seq_cplflds_inparm + + .true. if select per ice thickness category fields are passed to the ocean. + Set by the xml variable CPL_I2O_PER_CAT in env_run.xml + + + $CPL_I2O_PER_CAT + + + + + + + + + char(200) + seq_flds + seq_cplflds_userspec + + New fields that are user specidied can be added as namelist variables + by the user in the cpl namelist seq_flds_user using the namelist variable + array cplflds_customs. The user specified new fields must follow the + above naming convention. + As an example, say you want to add a new state 'foo' that is passed + from the land to the atm - you would do this as follows + &seq_flds_user + cplflds_custom = 'Sa_foo->a2x', 'Sa_foo->x2a' + / + This would add the field 'Sa_foo' to the character strings defining the + attribute vectors a2x and x2a. It is assumed that code would need to be + introduced in the atm and land components to deal with this new attribute + vector field. + Modify user_nl_cpl to edit this. + + + '' + + + + + + + + + integer + time + seq_timemgr_inparm + + atm coupling interval in seconds + set via ATM_NCPL in env_run.xml. + ATM_NCPL is the number of times the atm is coupled per NCPL_BASE_PERIOD + NCPL_BASE_PERIOD is also set in env_run.xml and is the base period + associated with NCPL coupling frequency, and has valid values: hour,day,year,decade + + + + + integer + time + seq_timemgr_inparm + + lnd coupling interval in seconds + set via LND_NCPL in env_run.xml. + LND_NCPL is the number of times the lnd is coupled per NCPL_BASE_PERIOD + NCPL_BASE_PERIOD is also set in env_run.xml and is the base period + associated with NCPL coupling frequency, nad has valid values: hour,day,year,decade + + + + + integer + time + seq_timemgr_inparm + + river runoff coupling interval in seconds + currently set by default to 10800 seconds. + default: 10800 + + + + + integer + time + seq_timemgr_inparm + + ice coupling interval in seconds + set via ICE_NCPL in env_run.xml. + ICE_NCPL is the number of times the ice is coupled per NCPL_BASE_PERIOD + NCPL_BASE_PERIOD is also set in env_run.xml and is the base period + associated with NCPL coupling frequency, nad has valid values: hour,day,year,decade + + + + + integer + time + seq_timemgr_inparm + + ocn coupling interval in seconds + set via OCN_NCPL in env_run.xml. + OCN_NCPL is the number of times the ocn is coupled per NCPL_BASE_PERIOD + NCPL_BASE_PERIOD is also set in env_run.xml and is the base period + associated with NCPL coupling frequency, nad has valid values: hour,day,year,decade + + + + + integer + time + seq_timemgr_inparm + + glc coupling interval in seconds + set via GLC_NCPL in env_run.xml. + GLC_NCPL is the number of times the glc is coupled per NCPL_BASE_PERIOD + NCPL_BASE_PERIOD is also set in env_run.xml and is the base period + associated with NCPL coupling frequency, nad has valid values: hour,day,year,decade + + + + + char + time + seq_timemgr_inparm + glc_coupling_period,yearly + + $GLC_AVG_PERIOD + + + Period at which coupler averages fields sent to GLC. + This supports doing the averaging to GLC less frequently than GLC is called + (i.e., separating the averaging frequency from the calling frequency). + This is useful because there are benefits to only averaging the GLC inputs + as frequently as they are really needed (yearly for CISM), but GLC needs to + still be called more frequently than that in order to support mid-year restarts. + + Setting glc_avg_period to 'glc_coupling_period' means that the averaging is + done exactly when the GLC is called (governed by GLC_NCPL). + + + + + integer + time + seq_timemgr_inparm + + wav coupling interval in seconds + set via WAV_NCPL in env_run.xml. + WAV_NCPL is the number of times the wav is coupled per NCPL_BASE_PERIOD + NCPL_BASE_PERIOD is also set in env_run.xml and is the base period + associated with NCPL coupling frequency, nad has valid values: hour,day,year,decade + + + + + integer + time + seq_timemgr_inparm + + esp run interval in seconds + esp_cpl_dt is the number of times the esp is run per NCPL_BASE_PERIOD + NCPL_BASE_PERIOD is set in env_run.xml and is the base period + associated with NCPL coupling frequency, nad has valid values: hour,day,year,decade + default value set by buildnml to be the pause interval if pause is active + otherwise, it is set to the shortest component coupling time + + + -999 + + + + + integer + time + seq_timemgr_inparm + + atm coupling interval offset in seconds default: 0 + + + 0 + + + + + integer + time + seq_timemgr_inparm + + lnd coupling interval offset in seconds default: 0 + + + 0 + + + + + integer + time + seq_timemgr_inparm + + ice coupling interval offset in seconds default: 0 + + + 0 + + + + + integer + time + seq_timemgr_inparm + + ocn coupling interval offset in seconds default: 0 + + + 0 + + + + + integer + time + seq_timemgr_inparm + + glc coupling interval offset in seconds default: 0 + + + 0 + + + + + integer + time + seq_timemgr_inparm + + wav coupling interval offset in seconds default: 0 + + + 0 + + + + + integer + time + seq_timemgr_inparm + + esp coupling interval offset in seconds default: 0 + + + 0 + + + + + logical + time + seq_timemgr_inparm + + true => ESP component runs after driver 'pause cycle' + If any component 'pauses' (see PAUSE_OPTION, PAUSE_N and + PAUSE_COMPONENT_LIST XML variables), the ESP component (if + present) will be run to process the component 'pause' (restart) + files and set any required 'resume' signals. + If true, esp_cpl_dt and esp_cpl_offset settings are ignored. + default: true + + + .true. + + + + + char + time + seq_timemgr_inparm + NO_LEAP,GREGORIAN + + calendar in use. [NO_LEAP, GREOGORIAN]. + set by CALENDAR in env_build.xml + + + $CALENDAR + + + + + integer + time + seq_timemgr_inparm + + Run start date in yyyymmdd format, only used for startup and hybrid runs. + default: 00010101 + + + 00010101 + + + + + integer + time + seq_timemgr_inparm + + Start time-of-day in universal time (seconds), should be between zero and 86400 + default: 0 + + + $START_TOD + + + + + char + time + seq_timemgr_inparm + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,monthly,nmonths,nmonth,nyears,nyear,date,ifdays0,end + + sets the run length with stop_n and stop_ymd + stop_option alarms are: + [none/never], turns option off + [nstep/s] , stops every stop_n nsteps , relative to current run start time + [nsecond/s] , stops every stop_n nseconds, relative to current run start time + [nminute/s] , stops every stop_n nminutes, relative to current run start time + [nhour/s] , stops every stop_n nhours , relative to current run start time + [nday/s] , stops every stop_n ndays , relative to current run start time + [nmonth/s] , stops every stop_n nmonths , relative to current run start time + [monthly/s] , stops every month , relative to current run start time + [nyear/s] , stops every stop_n nyears , relative to current run start time + [date] , stops at stop_ymd value + [ifdays0] , stops at stop_n calendar day value and seconds equal 0 + [end] , stops at end + + + $STOP_OPTION + + + + + integer + time + seq_timemgr_inparm + + Sets the run length with stop_option and stop_ymd + + + $STOP_N + + + + + integer + time + seq_timemgr_inparm + + date in yyyymmdd format, sets the run length with stop_option and stop_n, + can be in addition to stop_option and stop_n, negative value implies off + + + $STOP_DATE + + + + + char + time + seq_timemgr_inparm + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,nmonths,monthly,nmonth,nyears,nyear,date,ifdays0,end + + sets the restart frequency with restart_n and restart_ymd + restart_option alarms are: + [none/never], turns option off + [nstep/s] , restarts every restart_n nsteps , relative to current run start time + [nsecond/s] , restarts every restart_n nseconds, relative to current run start time + [nminute/s] , restarts every restart_n nminutes, relative to current run start time + [nhour/s] , restarts every restart_n nhours , relative to current run start time + [nday/s] , restarts every restart_n ndays , relative to current run start time + [monthly/s] , restarts every month , relative to current run start time + [nmonth/s] , restarts every restart_n nmonths , relative to current run start time + [nyear/s] , restarts every restart_n nyears , relative to current run start time + [date] , restarts at restart_ymd value + [ifdays0] , restarts at restart_n calendar day value and seconds equal 0 + [end] , restarts at end + + + $REST_OPTION + + + + + integer + time + seq_timemgr_inparm + + Sets model restart writes with restart_option and restart_ymd (same options as stop_n) + + + $REST_N + + + + + integer + time + seq_timemgr_inparm + + Date in yyyymmdd format, sets model restart write date with rest_option and restart_n + default: STOP_N + + + $REST_DATE + + + + + logical + time + seq_timemgr_inparm + + true => write restarts at end of run + forces a restart write at the end of the run in addition to any + setting associated with rest_option. default=true. this setting + will be set to false if restart_option is none or never. + default: false + + + .false. + + + + + char + time + seq_timemgr_inparm + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,monthly,nmonths,nmonth,nyears,nyear,date,ifdays0,end + + coupler history snapshot option (used with history_n and history_ymd) + set by HIST_OPTION in env_run.xml. + history_option alarms are: + [none/never], turns option off + [nstep/s] , history snapshot every history_n nsteps , relative to current run start time + [nsecond/s] , history snapshot every history_n nseconds, relative to current run start time + [nminute/s] , history snapshot every history_n nminutes, relative to current run start time + [nhour/s] , history snapshot every history_n nhours , relative to current run start time + [nday/s] , history snapshot every history_n ndays , relative to current run start time + [monthly/s] , history snapshot every month , relative to current run start time + [nmonth/s] , history snapshot every history_n nmonths , relative to current run start time + [nyear/s] , history snapshot every history_n nyears , relative to current run start time + [date] , history snapshot at history_ymd value + [ifdays0] , history snapshot at history_n calendar day value and seconds equal 0 + [end] , history snapshot at end + + + $HIST_OPTION + + + + + integer + time + seq_timemgr_inparm + + sets coupler snapshot history file frequency (like restart_n) + set by HIST_N in env_run.xml. + + + $HIST_N + + + + + integer + time + seq_timemgr_inparm + + date associated with history_option date. yyyymmdd format. + set by HIST_DATE in env_run.xml. + + + $HIST_DATE + + + + + char + time + seq_timemgr_inparm + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,monthly,nmonths,nmonth,nyears,nyear,date,ifdays0,end + + coupler time average history option (used with histavg_n and histavg_ymd) + set by AVGHIST_OPTION in env_run.xml. + histavg_option alarms are: + [none/never], turns option off + [nstep/s] , history snapshot every histavg_n nsteps , relative to current run start time + [nsecond/s] , history snapshot every histavg_n nseconds, relative to current run start time + [nminute/s] , history snapshot every histavg_n nminutes, relative to current run start time + [nhour/s] , history snapshot every histavg_n nhours , relative to current run start time + [nday/s] , history snapshot every histavg_n ndays , relative to current run start time + [monthly/s] , history snapshot every month , relative to current run start time + [nmonth/s] , history snapshot every histavg_n nmonths , relative to current run start time + [nyear/s] , history snapshot every histavg_n nyears , relative to current run start time + [date] , history snapshot at histavg_ymd value + [ifdays0] , history snapshot at histavg_n calendar day value and seconds equal 0 + [end] , history snapshot at end + + + $AVGHIST_OPTION + + + + + integer + time + seq_timemgr_inparm + + Sets coupler time-average history file frequency (like restart_option) + set by AVGHIST_N in env_run.xml. + + + $AVGHIST_N + + + + + integer + time + seq_timemgr_inparm + + date associated with histavg_option date. yyyymmdd format. + set by AVGHIST_DATE in env_run.xml. + + + $AVGHIST_DATE + + + + + char + time + seq_timemgr_inparm + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,nmonths,monthly,nmonth,nyears,nyear,date,ifdays0,end + + sets the driver barrier frequency to sync models across all tasks with barrier_n and barrier_ymd + barrier_option alarms are like restart_option + default: never + + + $BARRIER_OPTION + + + + + integer + time + seq_timemgr_inparm + + Sets model barriers with barrier_option and barrier_ymd (same options as stop_n) + default: 1 + + + $BARRIER_N + + + + + integer + time + seq_timemgr_inparm + + Date in yyyymmdd format, sets model barriers date with barrier_option and barrier_n + + + $BARRIER_DATE + + + + + char + time + seq_timemgr_inparm + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,monthly,nmonths,nmonth,nyears,nyear,date,ifdays0,end + + Sets timing output file frequency (like rest_option but relative to run start date) + tprof_option alarms are: + [none/never], turns option off + [nstep/s] , every tprof_n nsteps , relative to current run start time + [nsecond/s] , every tprof_n nseconds, relative to current run start time + [nminute/s] , every tprof_n nminutes, relative to current run start time + [nhour/s] , every tprof_n nhours , relative to current run start time + [nday/s] , every tprof_n ndays , relative to current run start time + [monthly/s] , every month , relative to current run start time + [nmonth/s] , every tprof_n nmonths , relative to current run start time + [nyear/s] , every tprof_n nyears , relative to current run start time + [date] , at tprof_ymd value + [ifdays0] , at tprof_n calendar day value and seconds equal 0 + [end] , at end + + + never + + + + + integer + time + seq_timemgr_inparm + + Sets timing output file frequency (like restart_n) + + + -999 + + + + + integer + time + seq_timemgr_inparm + + yyyymmdd format, sets timing output file date (like restart_date) + + + -999 + + + + + char + time + seq_timemgr_inparm + none,never,nsteps,nstep,nseconds,nsecond,nminutes,nminute,nhours,nhour,ndays,nday,monthly,nmonths,nmonth,nyears,nyear + + sets the pause frequency with pause_n + pause_option alarms are: + [none/never], turns option off + [nstep/s] , pauses every pause_n nsteps , relative to start or last pause time + [nsecond/s] , pauses every pause_n nseconds, relative to start or last pause time + [nminute/s] , pauses every pause_n nminutes, relative to start or last pause time + [nhour/s] , pauses every pause_n nhours , relative to start or last pause time + [nday/s] , pauses every pause_n ndays , relative to start or last pause time + [nmonth/s] , pauses every pause_n nmonths , relative to start or last pause time + [monthly/s] , pauses every month , relative to start or last pause time + [nyear/s] , pauses every pause_n nyears , relative to start or last pause time + + + $PAUSE_OPTION + + + + + integer + time + seq_timemgr_inparm + + Sets the pause frequency with pause_option + + + $PAUSE_N + + + + + char + time + seq_timemgr_inparm + + A colon-separated list of component types (e.g., ocn,atm) to receive a + resume signal after a pause has happened. Special values "all" or "none" + may be used in place of a list + + + $PAUSE_COMPONENT_LIST + + + + + + + + + integer + ccsm_pes + ccsm_pes + + the number of mpi tasks assigned to the atm components. + set by NTASKS_ATM in env_configure.xml. + + + $NTASKS_ATM + + + + + integer + ccsm_pes + ccsm_pes + + the number of threads per mpi task for the atm component. + set by NTHRDS_ATM in env_configure.xml. + + + $NTHRDS_ATM + + + + + integer + ccsm_pes + ccsm_pes + + the global mpi task rank of the root processor assigned to the atm component. + set by ROOTPE_ATM in env_configure.xml. + + + $ROOTPE_ATM + + + + + integer + ccsm_pes + ccsm_pes + + the mpi global processors stride associated with the mpi tasks for the atm component. + set by PSTRID_ATM in env_configure.xml. + + + $PSTRID_ATM + + + + + char + ccsm_pes + ccsm_pes + concurrent,sequential + + Layout of multi-instance atms (if there are more than 1) + + + $NINST_ATM_LAYOUT + + + + + integer + ccsm_pes + ccsm_pes + + the number of mpi tasks assigned to the lnd components. + set by NTASKS_LND in env_configure.xml. + + + $NTASKS_LND + + + + + integer + ccsm_pes + ccsm_pes + + the number of threads per mpi task for the lnd component. + set by NTHRDS_LND in env_configure.xml. + + + $NTHRDS_LND + + + + + integer + ccsm_pes + ccsm_pes + + the global mpi task rank of the root processor assigned to the lnd component. + set by ROOTPE_LND in env_configure.xml. + + + $ROOTPE_LND + + + + + integer + ccsm_pes + ccsm_pes + + the mpi global processors stride associated with the mpi tasks for the lnd component. + set by PSTRID_LND in env_configure.xml. + + + $PSTRID_LND + + + + + char + ccsm_pes + ccsm_pes + concurrent,sequential + + Layout of multi-instance lnds (if there are more than 1) + + + $NINST_LND_LAYOUT + + + + + integer + ccsm_pes + ccsm_pes + + the number of mpi tasks assigned to the ice components. + set by NTASKS_ICE in env_configure.xml. + + + $NTASKS_ICE + + + + + integer + ccsm_pes + ccsm_pes + + the number of threads per mpi task for the ice component. + set by NTHRDS_ICE in env_configure.xml. + + + $NTHRDS_ICE + + + + + integer + ccsm_pes + ccsm_pes + + the global mpi task rank of the root processor assigned to the ice component. + set by ROOTPE_ICE in env_configure.xml. + + + $ROOTPE_ICE + + + + + integer + ccsm_pes + ccsm_pes + + the mpi global processors stride associated with the mpi tasks for the ice component. + set by PSTRID_ICE in env_configure.xml. + + + $PSTRID_ICE + + + + + char + ccsm_pes + ccsm_pes + concurrent,sequential + + Layout of multi-instance ices (if there are more than 1) + + + $NINST_ICE_LAYOUT + + + + + integer + ccsm_pes + ccsm_pes + + the number of mpi tasks assigned to the ocn components. + set by NTASKS_OCN in env_configure.xml. + + + $NTASKS_OCN + + + + + integer + ccsm_pes + ccsm_pes + + the number of threads per mpi task for the ocn component. + set by NTHRDS_OCN in env_configure.xml. + + + $NTHRDS_OCN + + + + + integer + ccsm_pes + ccsm_pes + + the global mpi task rank of the root processor assigned to the ocn component. + set by ROOTPE_OCN in env_configure.xml. + + + $ROOTPE_OCN + + + + + integer + ccsm_pes + ccsm_pes + + the mpi global processors stride associated with the mpi tasks for the ocn component. + set by PSTRID_OCN in env_configure.xml. default: 1 + + + $PSTRID_OCN + + + + + char + ccsm_pes + ccsm_pes + concurrent,sequential + + Layout of multi-instance ocns (if there are more than 1) + + + $NINST_OCN_LAYOUT + + + + + integer + ccsm_pes + ccsm_pes + + the number of mpi tasks assigned to the glc components. + set by NTASKS_GLC in env_configure.xml. + + + $NTASKS_GLC + + + + + integer + ccsm_pes + ccsm_pes + + the number of threads per mpi task for the glc component. + set by NTHRDS_GLC in env_configure.xml. + + + $NTHRDS_GLC + + + + + integer + ccsm_pes + ccsm_pes + + the global mpi task rank of the root processor assigned to the glc component. + set by ROOTPE_GLC in env_configure.xml. + + + $ROOTPE_GLC + + + + + integer + ccsm_pes + ccsm_pes + + the mpi global processors stride associated with the mpi tasks for the glc component. + set by PSTRID_GLC in env_configure.xml. + + + $PSTRID_GLC + + + + + char + ccsm_pes + ccsm_pes + concurrent,sequential + + Layout of multi-instance glcs (if there are more than 1) + + + $NINST_GLC_LAYOUT + + + + + integer + ccsm_pes + ccsm_pes + + the number of mpi tasks assigned to the wav components. + set by NTASKS_WAV in env_configure.xml. + + + $NTASKS_WAV + + + + + integer + ccsm_pes + ccsm_pes + + the number of threads per mpi task for the wav component. + set by NTHRDS_WAV in env_configure.xml. + + + $NTHRDS_WAV + + + + + integer + ccsm_pes + ccsm_pes + + the global mpi task rank of the root processor assigned to the wav component. + set by ROOTPE_WAV in env_configure.xml. + + + $ROOTPE_WAV + + + + + integer + ccsm_pes + ccsm_pes + + the mpi global processors stride associated with the mpi tasks for the wav component. + set by PSTRID_WAV in env_configure.xml. + + + $PSTRID_WAV + + + + + char + ccsm_pes + ccsm_pes + concurrent,sequential + + Layout of multi-instance wavs (if there are more than 1) + + + $NINST_WAV_LAYOUT + + + + + integer + ccsm_pes + ccsm_pes + + the number of mpi tasks assigned to the lnd components. + set by NTASKS_LND in env_configure.xml. + + + $NTASKS_ROF + + + + + integer + ccsm_pes + ccsm_pes + + the number of threads per mpi task for the lnd component. + set by NTHRDS_ROF in env_configure.xml. + + + $NTHRDS_ROF + + + + + integer + ccsm_pes + ccsm_pes + + the global mpi task rank of the root processor assigned to the lnd component. + set by ROOTPE_LND in env_configure.xml. + + + $ROOTPE_ROF + + + + + integer + ccsm_pes + ccsm_pes + + the mpi global processors stride associated with the mpi tasks for the lnd component. + set by PSTRID_LND in env_configure.xml. + + + $PSTRID_ROF + + + + + char + ccsm_pes + ccsm_pes + concurrent,sequential + + Layout of multi-instance lnds (if there are more than 1) + + + $NINST_ROF_LAYOUT + + + + + integer + ccsm_pes + ccsm_pes + + the number of mpi tasks assigned to the esp components. + set by NTASKS_ESP in env_configure.xml. + + + $NTASKS_ESP + + + + + integer + ccsm_pes + ccsm_pes + + the number of threads per mpi task for the esp component. + set by NTHRDS_ESP in env_configure.xml. + + + $NTHRDS_ESP + + + + + integer + ccsm_pes + ccsm_pes + + the global mpi task rank of the root processor assigned to the esp component. + set by ROOTPE_ESP in env_configure.xml. + + + $ROOTPE_ESP + + + + + integer + ccsm_pes + ccsm_pes + + the mpi global processors stride associated with the mpi tasks for the esp component. + set by PSTRID_ESP in env_configure.xml. + + + $PSTRID_ESP + + + + + char + ccsm_pes + ccsm_pes + concurrent,sequential + + Layout of multi-instance external system processor (if there are more than 1) + + + $NINST_ESP_LAYOUT + + + + + integer + ccsm_pes + ccsm_pes + + the number of mpi tasks assigned to the cpl components. + set by NTASKS_CPL in env_configure.xml. + + + $NTASKS_CPL + + + + + integer + ccsm_pes + ccsm_pes + + the number of threads per mpi task for the cpl component. + set by NTHRDS_CPL in env_configure.xml. + + + $NTHRDS_CPL + + + + + integer + ccsm_pes + ccsm_pes + + the global mpi task rank of the root processor assigned to the cpl component. + set by ROOTPE_CPL in env_configure.xml. + + + $ROOTPE_CPL + + + + + integer + ccsm_pes + ccsm_pes + + the mpi global processors stride associated with the mpi tasks for the cpl component. + set by PSTRID_CPL in env_configure.xml. + + + $PSTRID_CPL + + + + + char + ccsm_pes + ccsm_pes + + Determines what ESMF log files (if any) are generated when + USE_ESMF_LIB is TRUE. + ESMF_LOGKIND_SINGLE: Use a single log file, combining messages from + all of the PETs. Not supported on some platforms. + ESMF_LOGKIND_MULTI: Use multiple log files — one per PET. + ESMF_LOGKIND_NONE: Do not issue messages to a log file. + By default, no ESMF log files are generated. + + + $ESMF_LOGFILE_KIND + + + + + + + + + + logical + performance + prof_inparm + + + + .true. + + + + + logical + performance + prof_inparm + + + + .false. + + + + + logical + performance + prof_inparm + + + + .false. + .true. + + + + + logical + performance + prof_inparm + + + + .false. + + + + + integer + performance + prof_inparm + + + + $TIMER_LEVEL + + + + + integer + performance + prof_inparm + + + + 0 + + + + + integer + performance + prof_inparm + + + + $TIMER_DETAIL + + + + + integer + performance + prof_inparm + + + + 4 + 2 + 1 + 3 + + + + + logical + performance + prof_inparm + + default: .false. + + + .false. + + + + + logical + performance + prof_inparm + + default: .false. + + + .false. + + + + + integer + performance + prof_inparm + + default: 1 + + + 1 + + + + + logical + performance + prof_inparm + + default: .false. + + + $PROFILE_PAPI_ENABLE + + + + + + + + + + char + performance + papi_inparm + + See gptl_papi.c for the list of valid values + + + PAPI_FP_OPS + + + + + char + performance + papi_inparm + + See gptl_papi.c for the list of valid values + + + PAPI_NO_CTR + + + + + char + performance + papi_inparm + + See gptl_papi.c for the list of valid values + + + PAPI_NO_CTR + + + + + char + performance + papi_inparm + + See gptl_papi.c for the list of valid values + + + PAPI_NO_CTR + + + + + + + + + logical + pio + pio_default_inparm + + future asynchronous IO capability (not currently supported). + If pio_async_interface is .true. or {component}_PIO_* variable is not set or set to -99 + the component variable will be set using the pio_* value. + default: .false. + + + $PIO_ASYNC_INTERFACE + + + + + integer + pio + pio_default_inparm + 0,1,2,3,4,5,6 + + pio debug level + valid values: 0,1,2,3,4,5,6 + + + $PIO_DEBUG_LEVEL + + + + + integer + pio + pio_default_inparm + + blocksize for pio box rearranger + + + $PIO_BLOCKSIZE + + + + + integer + pio + pio_default_inparm + + pio buffer size limit + + + $PIO_BUFFER_SIZE_LIMIT + + + + + char + pio + pio_default_inparm + p2p,coll,default + + pio rearranger communication type. + valid values: p2p, coll, default + + + $PIO_REARR_COMM_TYPE + + + + + char + pio + pio_default_inparm + 2denable,io2comp,comp2io,disable,default + + pio rearranger communication flow control direction. + + + $PIO_REARR_COMM_FCD + + + + + integer + pio + pio_default_inparm + + pio rearranger communication max pending req (comp2io) + + + $PIO_REARR_COMM_MAX_PEND_REQ_COMP2IO + + + + + logical + pio + pio_default_inparm + + pio rearranger communication option: Enable handshake (comp2io) + + + $PIO_REARR_COMM_ENABLE_HS_COMP2IO + + + + + logical + pio + pio_default_inparm + + pio rearranger communication option: Enable isends (comp2io) + + + $PIO_REARR_COMM_ENABLE_ISEND_COMP2IO + + + + + integer + pio + pio_default_inparm + + pio rearranger communication max pending req (io2comp) + + + $PIO_REARR_COMM_MAX_PEND_REQ_IO2COMP + + + + + logical + pio + pio_default_inparm + + pio rearranger communication option: Enable handshake (io2comp) + + + $PIO_REARR_COMM_ENABLE_HS_IO2COMP + + + + + logical + pio + pio_default_inparm + + pio rearranger communication option: Enable isends (io2comp) + default: .false. + + + $PIO_REARR_COMM_ENABLE_ISEND_IO2COMP + + + + + char(10) + drv_physics + default_settings + + List of files to merge together that contains drv_flds_in namelists + The paths are relative to the case directory. drv_flds_in include the namelists that + the driver reads and gives information on additional fields to be passed to different + components that need to look at the same data. + + + Buildconf/camconf/drv_flds_in,Buildconf/clmconf/drv_flds_in + + + + + diff --git a/src/drivers/nuopc/cime_config/namelist_definition_drv_flds.xml b/src/drivers/nuopc/cime_config/namelist_definition_drv_flds.xml new file mode 100644 index 00000000000..08847103afd --- /dev/null +++ b/src/drivers/nuopc/cime_config/namelist_definition_drv_flds.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + char + abs + drv_flds_in + megan_emis_nl + + File containing MEGAN emissions factors. Includes the list of MEGAN compounds that can be + used in the Comp_Name variable on the file. + + + + + char(100) + drv_flds_in + megan_emis_nl + + MEGAN specifier. This is in the form of: Chem-compound = megan_compound(s) + where megan_compound(s) can be the sum of megan compounds with a "+" between them. + In each equation, the item to the left of the equal sign is a CAM chemistry compound, the + items to the right are compounds known to the MEGAN model (single or combinations). + For example: megan_specifier = 'ISOP = isoprene', 'C10H16 = pinene_a + carene_3 + thujene_a' + + + + + logical + drv_flds_in + megan_emis_nl + + MEGAN mapped isoprene emissions factors switch + If TRUE then use mapped MEGAN emissions factors for isoprene. + + + + + char(150) + drv_flds_in + drv_physics + + List of possible MEGAN compounds to use + (the list used by the simulation is on the megan_factors_file as the Comp_Name) + + + + + + + + + char + dry-deposition + drydep_inparm + xactive_lnd,xactive_atm,table + + Where dry deposition is calculated (from land, atmosphere, or from a table) + This specifies the method used to calculate dry + deposition velocities of gas-phase chemical species. The available methods are: + 'table' - prescribed method in CAM + 'xactive_atm' - interactive method in CAM + 'xactive_lnd' - interactive method in CLM + + + + + char(300) + dry-deposition + drydep_inparm + + List of species that undergo dry deposition. + + + + + + + + + char(2) + nitrogen deposition + ndep_inparm + + List of nitrogen deposition fluxes to be sent from CAM to surfae models. + + + + + + + + + char + abs + Fire_emissions + fire_emis_nl + + File containing fire emissions factors. + + + + + char(100) + Fire_emissions + fire_emis_nl + + Fire emissions specifier. + + + + + logical + Fire_emissions + fire_emis_nl + + If ture fire emissions are input into atmosphere as elevated forcings. + Otherwise they are treated as surface emissions. + + + + + + + + + char + carma + carma_inparm + + List of fluxes needed by the CARMA model, from CLM to CAM. + + + + diff --git a/src/drivers/nuopc/cime_config/namelist_definition_modelio.xml b/src/drivers/nuopc/cime_config/namelist_definition_modelio.xml new file mode 100644 index 00000000000..474a34ee9f7 --- /dev/null +++ b/src/drivers/nuopc/cime_config/namelist_definition_modelio.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + integer + pio + pio_inparm + + stride of tasks in pio used generically, component based value takes precedent. + + + $CPL_PIO_STRIDE + $ATM_PIO_STRIDE + $LND_PIO_STRIDE + $OCN_PIO_STRIDE + $ICE_PIO_STRIDE + $ROF_PIO_STRIDE + $GLC_PIO_STRIDE + $WAV_PIO_STRIDE + -99 + + + + + integer + pio + pio_inparm + + io task root in pio used generically, component based value takes precedent. + + + $CPL_PIO_ROOT + $ATM_PIO_ROOT + $LND_PIO_ROOT + $OCN_PIO_ROOT + $ICE_PIO_ROOT + $ROF_PIO_ROOT + $GLC_PIO_ROOT + $WAV_PIO_ROOT + -99 + + + + + integer + pio + pio_inparm + -99,1,2 + + Rearranger method for pio 1=box, 2=subset. + + + $CPL_PIO_REARRANGER + $ATM_PIO_REARRANGER + $LND_PIO_REARRANGER + $OCN_PIO_REARRANGER + $ICE_PIO_REARRANGER + $ROF_PIO_REARRANGER + $GLC_PIO_REARRANGER + $WAV_PIO_REARRANGER + -99 + + + + + integer + pio + pio_inparm + + number of io tasks in pio used generically, component based value takes precedent. + + + $CPL_PIO_NUMTASKS + $ATM_PIO_NUMTASKS + $LND_PIO_NUMTASKS + $OCN_PIO_NUMTASKS + $ICE_PIO_NUMTASKS + $ROF_PIO_NUMTASKS + $GLC_PIO_NUMTASKS + $WAV_PIO_NUMTASKS + -99 + + + + + char*64 + pio + pio_inparm + netcdf,pnetcdf,netcdf4p,netcdf4c,default + + io type in pio used generically, component based value takes precedent. + valid values: netcdf, pnetcdf, netcdf4p, netcdf4c, default + + + $CPL_PIO_TYPENAME + $ATM_PIO_TYPENAME + $LND_PIO_TYPENAME + $OCN_PIO_TYPENAME + $ICE_PIO_TYPENAME + $ROF_PIO_TYPENAME + $GLC_PIO_TYPENAME + $WAV_PIO_TYPENAME + nothing + + + + + + + + + char*256 + modelio + modelio + input directory (no longer needed) + + UNSET + + + + + char*256 + modelio + modelio + directory for output log files + + UNSET + + + + + char*256 + modelio + modelio + name of component output log file + + UNSET + + + + diff --git a/src/drivers/nuopc/cime_config/namelist_definition_nuopc.xml b/src/drivers/nuopc/cime_config/namelist_definition_nuopc.xml new file mode 100644 index 00000000000..db59bf0115c --- /dev/null +++ b/src/drivers/nuopc/cime_config/namelist_definition_nuopc.xml @@ -0,0 +1,2445 @@ + + + + + + + + char + nuopc + nuopc_components_var + + ATM OCN ICE LND ROF MED + + + + + char + nuopc + DRIVER_attributes + + 0 + + + + + + + char + nuopc + DRIVER_attributes + + 0 + + + + + char + nuopc + nuopc_var + + cesm + + + + + char + nuopc + MED_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_ATM + + + + + char + nuopc + ATM_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_OCN + + + + + char + nuopc + OCN_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_ICE + + + + + char + nuopc + ICE_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_ROF + + + + + char + nuopc + ROF_attributes + + 0 + + + + + char + nuopc + nuopc_var + + $COMP_LND + + + + + char + nuopc + LND_attributes + + 0 + + + + + char + nuopc_attribute + nuopc_runseq + + + @86400 # 1 day time step + MED med_phases_prep_ocn + MED med_connectors_prep_med2ocn + MED -> OCN :remapMethod=redist + OCN + @48 # 30min time step + MED med_phases_prep_ice + MED med_connectors_prep_med2ice + MED -> ICE :remapMethod=redist + MED med_phases_prep_lnd + MED med_connectors_prep_med2lnd + MED -> LND :remapMethod=redist + MED med_phases_prep_rof + MED med_connectors_prep_med2rof + MED -> ROF :remapMethod=redist + ICE + LND + ROF + ROF -> MED :remapMethod=redist + MED med_connectors_post_rof2med + LND -> MED :remapMethod=redist + MED med_connectors_post_lnd2med + ICE -> MED :remapMethod=redist + MED med_connectors_post_ice2med + MED med_phases_prep_atm + MED med_connectors_prep_med2atm + MED -> ATM :remapMethod=redist + ATM + ATM -> MED :remapMethod=redist + MED med_connectors_post_atm2med + MED med_phases_accum_fast + @ + OCN -> MED :remapMethod=redist + MED med_connectors_post_ocn2med + @ + + + + + + + + + + char + expdef + DRIVER_info_attributes + acme,cesm + cime model + + cesm + acme + + + + + logical + expdef + DRIVER_info_attributes + + true => turn on aquaplanet mode in cam + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + + 1 => default sst mode for aquaplanet in cam + + + 1 + + + + + char + expdef + DRIVER_info_attributes + + case name. + + + $CASE + + + + + char + expdef + DRIVER_info_attributes + + case description. + + + $CASESTR + + + + + + + char + expdef + DRIVER_info_attributes + + username documentation + + + $USER + + + + + char + expdef + DRIVER_info_attributes + + hostname information, + + + $MACH + + + + + char + expdef + DRIVER_info_attributes + + location of timing output. + + + ./timing + + + + + char + expdef + DRIVER_info_attributes + + location of timing checkpoint output. + + + ./timing/checkpoints + + + + + char + expdef + DRIVER_info_attributes + startup,branch,continue + + mode to start the run up, [startup,branch,continue], + automatically derived from RUN_TYPE in env_run.xml + + + startup + startup + branch + continue + continue + continue + + + + + logical + expdef + DRIVER_info_attributes + + Allow same branch casename as reference casename. If $CASE and $REFCASE are the same and the start_type is + not startup, then the value of brnch_retain_casename is set to .true. + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + + Level of debug output, 0=minimum, 1=normal, 2=more, 3=too much (default: 1) + + + $INFO_DBUG + + + + + logical + expdef + DRIVER_info_attributes + + turns on bfb option in coupler which produce bfb results in the + coupler on different processor counts. (default: .false.) + + + $BFBFLAG + + + + + char + orbital + DRIVER_info_attributes + fixed_year,variable_year,fixed_parameters + + orbital model setting. this sets how the orbital mode will be + configured. + "fixed_year" uses the orb_iyear and other orb inputs are ignored. In + this mode, the orbital parameters are constant and based on the year. + "variable_year" uses the orb_iyear and orb_iyear_align. In this mode, + the orbital parameters vary as the model year advances and the model + year orb_iyear_align has the equivalent orbital year of orb_iyear. + "fixed_parameters" uses the orb_eccen, orb_mvelp, and orb_obliq to set + the orbital parameters which then remain constant through the model + integration. [fixed_year, variable_year, fixed_parameters] (default: 'fixed_year'.) + + + fixed_year + + + + + integer + orbital + DRIVER_info_attributes + + model year associated with orb_iyear when orb_mode is variable_year. (default: 1990) + + + 1990 + + + + + integer + orbital + DRIVER_info_attributes + + year of orbit, used when orb_mode is fixed_year or variable_year. (default: 1990) + + + 1990 + + + + + real + orbital + DRIVER_info_attributes + + eccentricity of orbit, used when orb_mode is fixed_parameters. + default: SHR_ORB_UNDEF_REAL (1.e36) (Not currently used in build-namelist) + + + 1.e36 + + + + + real + orbital + DRIVER_info_attributes + + location of vernal equinox in longitude degrees, used when orb_mode is fixed_parameters. + default: SHR_ORB_UNDEF_REAL (1.e36)(Not currently used in build-namelist) + + + 1.e36 + + + + + real + orbital + DRIVER_info_attributes + + obliquity of orbit in degrees, used when orb_mode is fixed_parameters. + default: SHR_ORB_UNDEF_REAL (1.e36) (Not currently used in build-namelist) + + + 1.e36 + + + + + char + wv_sat + DRIVER_info_attributes + GoffGratch,MurphyKoop,Bolton,Flatau + + Type of water vapor saturation vapor pressure scheme employed. 'GoffGratch' for + Goff and Gratch (1946); 'MurphyKoop' for Murphy and Koop (2005); 'Bolton' for + Bolton (1980); 'Flatau' for Flatau, Walko, and Cotton (1992). + Default: GoffGratch + + + GoffGratch + + + + + real + wv_sat + DRIVER_info_attributes + + Width of the liquid-ice transition range in mixed-phase water saturation vapor + pressure calculations. The range always ends at 0 degrees Celsius, so this + variable only affects the start of the transition. + Default: 20K + WARNING: CAM is tuned to the default value of this variable. Because it affects + so many different parameterizations, changes to this variable may require a + significant retuning of CAM's cloud physics to give reasonable results. + + + 20.0D0 + + + + + logical + wv_sat + DRIVER_info_attributes + + Whether or not to produce lookup tables at init time to use as a cache for + saturation vapor pressure. + Default: .false. + + + .false. + + + + + real + wv_sat + DRIVER_info_attributes + + Temperature resolution of saturation vapor pressure lookup tables in Kelvin. + (This is only used if wv_sat_use_tables is .true.) + Default: 1.0 + + + 1.0D0 + + + + + char + control + DRIVER_info_attributes + Freezing point calculation for salt water. + + $TFREEZE_SALTWATER_OPTION + + + + + char + control + DRIVER_info_attributes + off,ocn + + Only used for C,G compsets: if ocn, ocn provides EP balance factor for precip + + + $CPL_EPBAL + + + + + logical + control + DRIVER_info_attributes + + Only used for C,G compsets: if true, compute albedos to work with daily avg SW down + + + $CPL_ALBAV + + + + + char + control + DRIVER_info_attributes + on,off,on_if_glc_coupled_fluxes + + Whether to renormalize the surface mass balance (smb) sent from lnd to glc so that the + global integral on the glc grid agrees with the global integral on the lnd grid. + + Unlike most fluxes, smb is remapped with bilinear rather than conservative mapping weights, + so this option is needed for conservation. However, conservation is not required in many + cases, since we often run glc as a diagnostic (one-way-coupled) component. + + Allowable values are: + 'on': always do this renormalization + 'off': never do this renormalization (see WARNING below) + 'on_if_glc_coupled_fluxes': Determine at runtime whether to do this renormalization. + Does the renormalization if we're running a two-way-coupled glc that sends fluxes + to other components (which is the case where we need conservation). + Does NOT do the renormalization if we're running a one-way-coupled glc, or if + we're running a glc-only compset (T compsets). + (In these cases, conservation is not important.) + + Only used if running with a prognostic GLC component. + + WARNING: Setting this to 'off' will break conservation when running with an + evolving, two-way-coupled glc. + + + on_if_glc_coupled_fluxes + + + + + real + control + DRIVER_info_attributes + + Wall time limit for run + default: -1.0 + + + -1.0 + + + + + char + control + DRIVER_info_attributes + day,month,year + + Force stop at the next month, day, etc when wall_time_limit is hit + default: month + + + month + + + + + logical + control + DRIVER_info_attributes + + If true, turn on diurnal cycle in computing atm/ocn fluxes + default: false + + + .false. + + + + + real + control + DRIVER_info_attributes + + wind gustiness factor + + + 0.0D0 + + + + + char + mapping + DRIVER_info_attributes + + ATM_GRID values passed into driver. + + + $ATM_GRID + + + + + char + mapping + DRIVER_info_attributes + + LND_GRID values passed into driver. + + + $LND_GRID + + + + + char + mapping + DRIVER_info_attributes + + OCN_GRID values passed into driver. + + + $OCN_GRID + + + + + char + mapping + DRIVER_info_attributes + + ICE_GRID values passed into driver. + + + $ICE_GRID + + + + + char + mapping + DRIVER_info_attributes + + ROF_GRID values passed into driver. + + + $ROF_GRID + + + + + char + mapping + DRIVER_info_attributes + + GLC_GRID values passed into driver. + + + $GLC_GRID + + + + + char + mapping + DRIVER_info_attributes + + WAV_GRID values passed into driver. + + + $WAV_GRID + + + + + logical + mapping + DRIVER_info_attributes + + invoke pole averaging corrections in shr_map_mod weights generation (default: true) + + + .true. + + + + + char + mapping + DRIVER_info_attributes + none,npfix,cart3d,cart3d_diag,cart3d_uvw,cart3d_uvw_diag + + vect_map + turns on the vector mapping option for u and v vector mapping between + atm and ocean grids in the coupler. the options are none, npfix, + cart3d, cart3d_diag, cart3d_uvw, and cart3d_uvw_diag. the none option + results in scalar mapping independently for the u and v field which + tends to generate large errors near the poles. npfix is the + traditional option where the vectors are corrected on the ocean grid + north of the last latitude line of the atmosphere grid. the cart3d + options convert the east (u) and north (v) vectors to 3d (x,y,z) + triplets, and maps those fields before converting back to the east (u) + and north (v) directions. the cart3d ignores the resuling "w" + velocity. the cart3d_uvw calculates the resulting u and v vectors by + preserving the total "u,v,w" speed and the angle of the (u,v) vector. + the _diag options just add diagnotics to the log file about the vector + mapping. + + + $VECT_MAP + + + + + char + mapping + DRIVER_info_attributes + ocn,atm,exch + + Grid for atm ocn flux calc (untested) + default: ocn + + + ocn + + + + + logical + mapping + DRIVER_info_attributes + + mct alltoall mapping flag + default: false + + + .false. + + + + + logical + mapping + DRIVER_info_attributes + + mct vector flag + default: false + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + 0,1,2,3,4,5,6 + + cpl decomp option (0=default, 1=comp decomp, 2=rearr comp decomp, 3=new single 1d seg + default: 0 + + + $CPL_DECOMP + + + + + char + expdef + DRIVER_info_attributes + CESM1_ORIG,CESM1_MOD,CESM1_ORIG_TIGHT,CESM1_MOD_TIGHT,RASM_OPTION1,RASM_OPTION2 + + Set the coupler sequencing. + + + $CPL_SEQ_OPTION + + + + + logical + expdef + DRIVER_info_attributes + + default: true + + + .true. + + + + + logical + budget + DRIVER_info_attributes + + logical that turns on diagnostic budgets, false means budgets will never be written + + + $BUDGETS + + + + + logical + history + DRIVER_info_attributes + + logical to write an extra initial coupler history file + + + .false. + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the instantaneous budgets. [0,1,2,3], + written only if BUDGETS variable is true + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 0 + + + 0 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the daily budgets. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 0 + + + 0 + + + + + integer + expdef + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the monthy budgets. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 1 + + + 1 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the annual budgets. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets + default: 1 + + + 1 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the longterm budgets written at the end + of the year. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets, + default: 1 + + + 1 + + + + + integer + budget + DRIVER_info_attributes + 0,1,2,3 + + sets the diagnotics level of the longterm budgets written at the end + of each run. [0,1,2,3], + written only if do_budgets variable is .true., + 0=none, + 1=+net summary budgets, + 2=+detailed lnd/ocn/ice component budgets, + 3=+detailed atm budgets, + default: 0 + + + 0 + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for instantaneous atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 1-hour average atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 1-hour instantaneous atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 3-hour average atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for 3-hour average atm to coupler precip fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for daily average atm to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for instantaneous land to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for instantaneous runoff to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + turns on coupler history stream for annual sno to coupler fields. + default: false + + + .false. + + + + + logical + history + DRIVER_info_attributes + + writes atm fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes lnd fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes ocn fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes ice fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes rof fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes glc fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes wav fields in coupler average history files. + default: true + + + .true. + + + + + logical + history + DRIVER_info_attributes + + writes xao fields in coupler average history files. + default: true + + + .true. + + + + + logical + performance + DRIVER_info_attributes + + turn on run time control of threading per pe per component by the driver + default: false + + + $DRV_THREADING + + + + + logical + performance + DRIVER_info_attributes + + default: .false. + + + $COMP_RUN_BARRIERS + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in fractions in domain checking + default: 1.0e-02 + + + $EPS_FRAC + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in atm/land masks in domain checking + default: 1.0e-13 + + + $EPS_AMASK + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in atm/land lat/lon in domain checking + default: 1.0e-12 + + + $EPS_AGRID + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in atm/land areas in domain checking + default: 1.0e-07 + + + $EPS_AAREA + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in ocean/ice masks in domain checking + default: 1.0e-06 + + + $EPS_OMASK + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in ocean/ice lon/lat in domain checking + default: 1.0e-2 + + + $EPS_OGRID + + + + + real + domain_check + DRIVER_info_attributes + + Error tolerance for differences in ocean/ice lon/lat in domain checking + default: 1.0e-1 + + + $EPS_OAREA + + + + + logical + DRIVER_info_attributes + DRIVER_info_attributes + + turns on single column mode. set by PTS_MODE in env_case.xml, default: false + + + .false. + .true. + + + + + real + DRIVER_info_attributes + DRIVER_info_attributes + + grid point latitude associated with single column mode. + if set to -999, ignore this value + + + -999. + $PTS_LAT + + + + + real + DRIVER_info_attributes + DRIVER_info_attributes + + grid point longitude associated with single column mode. + set by PTS_LON in env_run.xml. + + + -999. + $PTS_LON + + + + + logical + reprosum + DRIVER_info_attributes + + Use faster method for reprosum, but one where reproducibility is not always guaranteed. + default: .false. + + + .false. + + + + + real + reprosum + DRIVER_info_attributes + + Tolerance for relative error + default: -1.0e-8 + + + -1.0e-8 + + + + + logical + reprosum + DRIVER_info_attributes + + Recompute with non-scalable algorithm if reprosum_diffmax is exceeded. + default: .false. + + + .false. + + + + + char + expdef + DRIVER_info_attributes + + Model version + + + unknown + + + + + char + expdef + DRIVER_info_attributes + + Driver restart pointer file. + + + rpointer.drv + + + + + char + expdef + DRIVER_info_attributes + + Full archive path to restart file + + + str_undefined + + + + + char + expdef + DRIVER_info_attributes + + Ending suffix "postfix" for output log files. + + + .log + + + + + char + expdef + DRIVER_info_attributes + + Root for output log files. + + + ./ + + + + + logical + expdef + DRIVER_info_attributes + + Perpetual flag + + + .false. + + + + + integer + expdef + DRIVER_info_attributes + + Perpetual date + + + -999 + + + + + real + expdef + DRIVER_info_attributes + + Abort if cplstep time exceeds this value + + + 0. + + + + + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ocn flux mapping file for fluxes + + + $ATM2OCN_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ocn state mapping file for states + + + $ATM2OCN_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ocn state mapping file for velocity + + + $ATM2OCN_VMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_VMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ocn to atm mapping file for fluxes + + + $OCN2ATM_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ocn to atm mapping file for states + + + $OCN2ATM_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ice flux mapping file for fluxes + + + $ATM2OCN_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ice state mapping file for states + + + $ATM2OCN_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to ice state mapping file for velocity + + + $ATM2OCN_VMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2OCN_VMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ice to atm mapping file for fluxes + + + $OCN2ATM_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ice to atm mapping file for states + + + $OCN2ATM_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2ATM_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to land mapping file for fluxes + + + $ATM2LND_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2LND_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to land mapping file for states + + + $ATM2LND_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2LND_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to atm mapping file for fluxes + + + $LND2ATM_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2ATM_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to atm mapping file for states + + + $LND2ATM_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2ATM_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + lnd to runoff conservative mapping file + + + $LND2ROF_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2ROF_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to lnd conservative mapping file + + + $ROF2LND_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2LND_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to ocn area overlap conservative mapping file + + + $ROF2OCN_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2OCN_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to ocn runoff conservative mapping file + + + $GLC2OCN_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2OCN_RMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to ice runoff conservative mapping file + + + $GLC2ICE_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2ICE_RMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to ocn nearest neighbor plus smoothing conservative mapping file + + + $ROF2OCN_LIQ_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2OCN_LIQ_RMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + runoff to ocn nearest neighbor plus smoothing conservative mapping file + + + $ROF2OCN_ICE_RMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ROF2OCN_ICE_RMAPTYPE + X + + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to glc mapping file for fluxes + + + $LND2GLC_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2GLC_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + land to glc mapping file for states + + + $LND2GLC_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $LND2GLC_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to land mapping file for fluxes + + + $GLC2LND_FMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2LND_FMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + glc to land mapping file for states + + + $GLC2LND_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $GLC2LND_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + atm to wav state mapping file for states + + + $ATM2WAV_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ATM2WAV_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ocn to wav state mapping file for states + + + $OCN2WAV_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $OCN2WAV_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + ice to wav state mapping file for states + + + $ICE2WAV_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $ICE2WAV_SMAPTYPE + X + + + + + char + mapping + abs + DRIVER_maps_attributes + + wav to ocn state mapping file for states + + + $WAV2OCN_SMAPNAME + + + + + char + mapping + DRIVER_maps_attributes + + The type of mapping desired, either "source" or "destination" mapping. + X is associated with rearrangement of the source grid to the + destination grid and then local mapping. Y is associated with mapping + on the source grid and then rearrangement and sum to the destination + grid. + + + $WAV2OCN_SMAPTYPE + X + + + + + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x history fields + + + Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x precipitation history output every 3 hours + + + Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x history output every 24 hours + + + Faxa_bcphiwet:Faxa_bcphodry:Faxa_bcphidry:Faxa_ocphiwet:Faxa_ocphidry:Faxa_ocphodry:Faxa_dstwet1:Faxa_dstdry1:Faxa_dstwet2:Faxa_dstdry2:Faxa_dstwet3:Faxa_dstdry3:Faxa_dstwet4:Faxa_dstdry4:Sa_co2prog:Sa_co2diag + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x instantaneous history output every hour + + + Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x averaged history output every hour + + + Sa_u:Sa_v + + + + + char + aux_hist + DRIVER_auxhist_attributes + + Auxiliary coupler a2x averaged history output every 3 hours + + + Sa_z:Sa_topo:Sa_u:Sa_v:Sa_tbot:Sa_ptem:Sa_shum:Sa_dens:Sa_pbot:Sa_pslv:Faxa_lwdn:Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl:Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf:Sa_co2diag:Sa_co2prog + + + + diff --git a/src/drivers/nuopc/cime_config/testdefs/testlist_drv.xml b/src/drivers/nuopc/cime_config/testdefs/testlist_drv.xml new file mode 100644 index 00000000000..a0c739c21c8 --- /dev/null +++ b/src/drivers/nuopc/cime_config/testdefs/testlist_drv.xml @@ -0,0 +1,609 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/drivers/nuopc/cime_config/testdefs/testmods_dirs/drv/5steps/shell_commands b/src/drivers/nuopc/cime_config/testdefs/testmods_dirs/drv/5steps/shell_commands new file mode 100644 index 00000000000..c72c4cfb820 --- /dev/null +++ b/src/drivers/nuopc/cime_config/testdefs/testmods_dirs/drv/5steps/shell_commands @@ -0,0 +1,2 @@ +./xmlchange STOP_OPTION="nsteps" + diff --git a/src/drivers/nuopc/cime_config/testdefs/testmods_dirs/drv/default/shell_commands b/src/drivers/nuopc/cime_config/testdefs/testmods_dirs/drv/default/shell_commands new file mode 100755 index 00000000000..180e38db21d --- /dev/null +++ b/src/drivers/nuopc/cime_config/testdefs/testmods_dirs/drv/default/shell_commands @@ -0,0 +1,2 @@ +./xmlchange HIST_OPTION=ndays +./xmlchange HIST_N=1 diff --git a/src/drivers/nuopc/cime_config/user_nl_cpl b/src/drivers/nuopc/cime_config/user_nl_cpl new file mode 100644 index 00000000000..a2095360793 --- /dev/null +++ b/src/drivers/nuopc/cime_config/user_nl_cpl @@ -0,0 +1,19 @@ +!------------------------------------------------------------------------ +! Users should ONLY USE user_nl_cpl to change namelists variables +! for namelist variables in drv_in (except for the ones below) and +! any keyword/values in seq_maps.rc +! Users should add ALL user specific namelist and seq_maps.rc changes below +! using the following syntax +! namelist_var = new_namelist_value +! or +! mapname = new_map_name +! For example to change the default value of ocn2atm_fmapname to 'foo' use +! ocn2atm_fmapname = 'foo' +! +! Note that some namelist variables MAY NOT be changed in user_nl_cpl - +! they are defined in a $CASEROOT xml file and must be changed with +! xmlchange. +! +! For example, rather than set username to 'foo' in user_nl_cpl, call +! ./xmlchange USER=foo +!------------------------------------------------------------------------ diff --git a/src/drivers/nuopc/cime_driver/cesm_init_mod.F90 b/src/drivers/nuopc/cime_driver/cesm_init_mod.F90 new file mode 100644 index 00000000000..c0249924a1e --- /dev/null +++ b/src/drivers/nuopc/cime_driver/cesm_init_mod.F90 @@ -0,0 +1,1177 @@ +module cesm_init_mod + + !---------------------------------------------------------------------------- + ! share code & libs + !---------------------------------------------------------------------------- + use ESMF + use NUOPC + use shr_kind_mod, only: SHR_KIND_R8 + use shr_kind_mod, only: SHR_KIND_CS + use shr_kind_mod, only: SHR_KIND_CL + use shr_sys_mod, only: shr_sys_abort, shr_sys_flush + use shr_const_mod, only: shr_const_cday + use shr_file_mod, only: shr_file_setLogLevel, shr_file_setLogUnit + use shr_file_mod, only: shr_file_setIO, shr_file_getUnit + use shr_scam_mod, only: shr_scam_checkSurface + use shr_map_mod, only: shr_map_setDopole + use shr_mpi_mod, only: shr_mpi_min, shr_mpi_max, shr_mpi_bcast, shr_mpi_chkerr + use shr_mem_mod, only: shr_mem_init, shr_mem_getusage + use shr_cal_mod, only: shr_cal_date2ymd, shr_cal_ymd2date, shr_cal_advdateInt + use shr_orb_mod, only: shr_orb_params + use shr_frz_mod, only: shr_frz_freezetemp_init + use shr_reprosum_mod, only: shr_reprosum_setopts + use perf_mod + + !---------------------------------------------------------------------------- + ! mpi comm data & routines, plus logunit and loglevel + !---------------------------------------------------------------------------- + use seq_comm_mct, only: CPLID, GLOID, logunit, loglevel + use seq_comm_mct, only: ATMID, LNDID, OCNID, ICEID, GLCID, ROFID, WAVID, ESPID + use seq_comm_mct, only: ALLATMID,ALLLNDID,ALLOCNID,ALLICEID,ALLGLCID,ALLROFID,ALLWAVID,ALLESPID + use seq_comm_mct, only: CPLALLATMID,CPLALLLNDID,CPLALLOCNID,CPLALLICEID + use seq_comm_mct, only: CPLALLGLCID,CPLALLROFID,CPLALLWAVID,CPLALLESPID + use seq_comm_mct, only: CPLATMID,CPLLNDID,CPLOCNID,CPLICEID,CPLGLCID,CPLROFID,CPLWAVID,CPLESPID + use seq_comm_mct, only: num_inst_atm, num_inst_lnd, num_inst_rof + use seq_comm_mct, only: num_inst_ocn, num_inst_ice, num_inst_glc + use seq_comm_mct, only: num_inst_wav, num_inst_esp + use seq_comm_mct, only: num_inst_xao, num_inst_frc, num_inst_phys + use seq_comm_mct, only: num_inst_total, num_inst_max + use seq_comm_mct, only: seq_comm_iamin, seq_comm_name, seq_comm_namelen, seq_comm_iamroot + use seq_comm_mct, only: seq_comm_init, seq_comm_setnthreads, seq_comm_getnthreads + use seq_comm_mct, only: seq_comm_gloroot + use seq_comm_mct, only: seq_comm_getinfo => seq_comm_setptrs + + !---------------------------------------------------------------------------- + ! clock & alarm routines and variables + !---------------------------------------------------------------------------- + use seq_timemgr_mod, only: seq_timemgr_type + use seq_timemgr_mod, only: seq_timemgr_clockInit + use seq_timemgr_mod, only: seq_timemgr_clockPrint + use seq_timemgr_mod, only: seq_timemgr_EClockGetData + use seq_timemgr_mod, only: seq_timemgr_histavg_type + use seq_timemgr_mod, only: seq_timemgr_type_never + use seq_timemgr_mod, only: seq_SyncClock => seq_timemgr_SyncClock + use seq_timemgr_mod, only: EClock_d => seq_timemgr_Eclock_d + use seq_timemgr_mod, only: EClock_a => seq_timemgr_Eclock_a + use seq_timemgr_mod, only: EClock_l => seq_timemgr_Eclock_l + use seq_timemgr_mod, only: EClock_o => seq_timemgr_Eclock_o + use seq_timemgr_mod, only: EClock_i => seq_timemgr_Eclock_i + use seq_timemgr_mod, only: EClock_g => seq_timemgr_Eclock_g + use seq_timemgr_mod, only: EClock_r => seq_timemgr_Eclock_r + use seq_timemgr_mod, only: EClock_w => seq_timemgr_Eclock_w + use seq_timemgr_mod, only: EClock_e => seq_timemgr_Eclock_e + + !---------------------------------------------------------------------------- + ! "infodata" gathers various control flags into one datatype + !---------------------------------------------------------------------------- + use seq_infodata_mod, only: seq_infodata_putData, seq_infodata_GetData + use seq_infodata_mod, only: seq_infodata_init1, seq_infodata_init2 + use seq_infodata_mod, only: seq_infodata_orb_variable_year + use seq_infodata_mod, only: seq_infodata_orb_fixed_year + use seq_infodata_mod, only: seq_infodata_orb_fixed_parameters + use seq_infodata_mod, only: infodata=>seq_infodata_infodata + + !---------------------------------------------------------------------------- + ! list of fields transferred between components + !---------------------------------------------------------------------------- + use seq_flds_mod, only : seq_flds_set + + !---------------------------------------------------------------------------- + ! timing routines + !---------------------------------------------------------------------------- + use t_drv_timers_mod + + ! MV: use seq_io_mod, only : seq_io_cpl_init + ! MV: use seq_io_mod, only : seq_io_cpl_init + ! MV: use cplcomp_exchange_mod, only: seq_mctext_decomp + + implicit none + + private + + public :: cesm_init + public :: mpicom_GLOID + +#include + + !---------------------------------------------------------------------------- + ! communicator groups and related + !---------------------------------------------------------------------------- + integer :: Global_Comm + + integer :: mpicom_GLOID ! MPI global communicator + integer :: mpicom_CPLID ! MPI cpl communicator + integer :: mpicom_OCNID ! MPI ocn communicator for ensemble member 1 + + integer :: mpicom_CPLALLATMID ! MPI comm for CPLALLATMID + integer :: mpicom_CPLALLLNDID ! MPI comm for CPLALLLNDID + integer :: mpicom_CPLALLICEID ! MPI comm for CPLALLICEID + integer :: mpicom_CPLALLOCNID ! MPI comm for CPLALLOCNID + integer :: mpicom_CPLALLGLCID ! MPI comm for CPLALLGLCID + integer :: mpicom_CPLALLROFID ! MPI comm for CPLALLROFID + integer :: mpicom_CPLALLWAVID ! MPI comm for CPLALLWAVID + + integer :: iam_GLOID ! pe number in global id + logical :: iamin_CPLID ! pe associated with CPLID + logical :: iamroot_GLOID ! GLOID masterproc + logical :: iamroot_CPLID ! CPLID masterproc + + logical :: iamin_CPLALLATMID ! pe associated with CPLALLATMID + logical :: iamin_CPLALLLNDID ! pe associated with CPLALLLNDID + logical :: iamin_CPLALLICEID ! pe associated with CPLALLICEID + logical :: iamin_CPLALLOCNID ! pe associated with CPLALLOCNID + logical :: iamin_CPLALLGLCID ! pe associated with CPLALLGLCID + logical :: iamin_CPLALLROFID ! pe associated with CPLALLROFID + logical :: iamin_CPLALLWAVID ! pe associated with CPLALLWAVID + + !---------------------------------------------------------------------------- + ! complist: list of comps on this pe + !---------------------------------------------------------------------------- + + ! allow enough room for names of all physical components + coupler, + ! where each string can be up to (max_inst_name_len+1) characters + ! long (+1 allows for a space before each name) + character(len=(seq_comm_namelen+1)*(num_inst_phys+1)) :: complist + + !---------------------------------------------------------------------------- + ! formats + !---------------------------------------------------------------------------- + character(*), parameter :: subname = '(seq_mct_drv)' + character(*), parameter :: F00 = "('"//subname//" : ', 4A )" + character(*), parameter :: F0L = "('"//subname//" : ', A, L6 )" + character(*), parameter :: F0I = "('"//subname//" : ', A, 2i8 )" + character(*), parameter :: F01 = "('"//subname//" : ', A, 2i8, 3x, A )" + character(*), parameter :: F0R = "('"//subname//" : ', A, 2g23.15 )" + character(*), parameter :: FormatA = '(A,": =============== ", A41, " ===============")' + character(*), parameter :: FormatD = '(A,": =============== ", A20,2I8,5x, " ===============")' + character(*), parameter :: FormatR = '(A,": =============== ", A31,F9.3,1x, " ===============")' + character(*), parameter :: FormatQ = '(A,": =============== ", A20,2F10.2,1x," ===============")' + +!=============================================================================== +contains +!=============================================================================== + + subroutine cesm_init(driver) + + ! USES: + use pio , only: file_desc_t, pio_closefile, pio_file_is_open + use shr_pio_mod , only: shr_pio_init1, shr_pio_init2 + use shr_const_mod , only: shr_const_tkfrz, shr_const_tktrip + use shr_const_mod , only: shr_const_mwwv, shr_const_mwdair + use shr_wv_sat_mod , only: shr_wv_sat_set_default, shr_wv_sat_init + use shr_wv_sat_mod , only: ShrWVSatTableSpec, shr_wv_sat_make_tables + use shr_wv_sat_mod, only: shr_wv_sat_get_scheme_idx, shr_wv_sat_valid_idx + use shr_orb_mod , only: SHR_ORB_UNDEF_INT, SHR_ORB_UNDEF_REAL, shr_orb_params + use shr_file_mod , only: shr_file_getUnit, shr_file_freeUnit + use shr_assert_mod , only: shr_assert_in_domain + use seq_io_read_mod , only: seq_io_read + + ! INPUT/OUTPUT PARAMETERS: + type(ESMF_GridComp), intent(inout) :: driver + + ! LOCAL + ! threading control + integer :: nthreads_GLOID ! OMP global number of threads + integer :: nthreads_CPLID ! OMP cpl number of threads + integer :: nthreads_ATMID ! OMP atm number of threads + integer :: nthreads_LNDID ! OMP lnd number of threads + integer :: nthreads_ICEID ! OMP ice number of threads + integer :: nthreads_OCNID ! OMP ocn number of threads + integer :: nthreads_GLCID ! OMP glc number of threads + integer :: nthreads_ROFID ! OMP glc number of threads + integer :: nthreads_WAVID ! OMP wav number of threads + integer :: nthreads_ESPID ! OMP esp number of threads + integer :: pethreads_GLOID ! OMP number of threads per task + logical :: drv_threading ! driver threading control + character(SHR_KIND_CL) :: cpl_seq_option ! coupler sequencing option + logical :: reprosum_use_ddpdd ! setup reprosum, use ddpdd + real(SHR_KIND_R8) :: reprosum_diffmax ! setup reprosum, set rel_diff_max + logical :: reprosum_recompute ! setup reprosum, recompute if tolerance exceeded + logical :: output_perf = .false. ! require timing data output for this pe + integer :: ymd ! Current date (YYYYMMDD) + integer :: year ! Current date (YYYY) + integer :: month ! Current date (MM) + integer :: day ! Current date (DD) + integer :: tod ! Current time of day (seconds) + character(SHR_KIND_CL) :: orb_mode ! orbital mode + character(SHR_KIND_CS) :: tfreeze_option ! Freezing point calculation + integer :: orb_iyear ! orbital year + integer :: orb_iyear_align ! associated with model year + integer :: orb_cyear ! orbital year for current orbital computation + integer :: orb_nyear ! orbital year associated with currrent model year + real(SHR_KIND_R8) :: orb_eccen ! orbital eccentricity + real(SHR_KIND_R8) :: orb_obliq ! obliquity in degrees + real(SHR_KIND_R8) :: orb_mvelp ! moving vernal equinox long + real(SHR_KIND_R8) :: orb_obliqr ! Earths obliquity in rad + real(SHR_KIND_R8) :: orb_lambm0 ! Mean long of perihelion at vernal equinox (radians) + real(SHR_KIND_R8) :: orb_mvelpp ! moving vernal equinox long + real(SHR_KIND_R8) :: wall_time_limit ! wall time limit in hours + character(SHR_KIND_CS) :: force_stop_at ! force stop at next (month, day, etc) + character(SHR_KIND_CS) :: cime_model ! currently acme or cesm + character(SHR_KIND_CL) :: atm_gnam ! atm grid + character(SHR_KIND_CL) :: lnd_gnam ! lnd grid + character(SHR_KIND_CL) :: ocn_gnam ! ocn grid + character(SHR_KIND_CL) :: ice_gnam ! ice grid + character(SHR_KIND_CL) :: rof_gnam ! rof grid + character(SHR_KIND_CL) :: glc_gnam ! glc grid + character(SHR_KIND_CL) :: wav_gnam ! wav grid + character(SHR_KIND_CL) :: samegrid_ao ! samegrid atm and ocean + character(SHR_KIND_CL) :: samegrid_al ! samegrid atm and land + character(SHR_KIND_CL) :: samegrid_lr ! samegrid land and rof + character(SHR_KIND_CL) :: samegrid_oi ! samegrid ocean and ice + character(SHR_KIND_CL) :: samegrid_ro ! samegrid runoff and ocean + character(SHR_KIND_CL) :: samegrid_aw ! samegrid atm and wave + character(SHR_KIND_CL) :: samegrid_ow ! samegrid ocean and wave + character(SHR_KIND_CL) :: samegrid_lg ! samegrid glc and land + character(SHR_KIND_CL) :: samegrid_og ! samegrid glc and ocean + character(SHR_KIND_CL) :: samegrid_ig ! samegrid glc and ice + character(SHR_KIND_CL) :: samegrid_alo ! samegrid atm, lnd, ocean + logical :: shr_map_dopole ! pole corrections in shr_map_mod + logical :: single_column ! scm mode logical + real(SHR_KIND_R8) :: scmlon ! single column lon + real(SHR_KIND_R8) :: scmlat ! single column lat + logical :: aqua_planet ! aqua planet mode (cam only) + logical :: atm_aero ! atm provides aerosol data + type(file_desc_t) :: pioid + integer :: maxthreads + character(SHR_KIND_CS) :: wv_sat_scheme + real(SHR_KIND_R8) :: wv_sat_transition_start + logical :: wv_sat_use_tables + real(SHR_KIND_R8) :: wv_sat_table_spacing + character(SHR_KIND_CL) :: errstring + character(SHR_KIND_CL) :: cvalue + type(ShrWVSatTableSpec) :: liquid_spec + type(ShrWVSatTableSpec) :: ice_spec + type(ShrWVSatTableSpec) :: mixed_spec + integer :: comp_id(num_inst_total) + integer :: comp_comm(num_inst_total) + integer :: comp_comm_iam(num_inst_total) + logical :: comp_iamin(num_inst_total) + character(len=seq_comm_namelen) :: comp_name(num_inst_total) + logical :: flag + integer :: i, it + character(SHR_KIND_CL) :: start_type ! Type of startup + logical :: read_restart ! read the restart file, based on start_type + character(SHR_KIND_CL) :: restart_file ! Full archive path to restart file + character(SHR_KIND_CL) :: restart_pfile ! Restart pointer file + real(SHR_KIND_R8) :: nextsw_cday ! calendar of next atm shortwave + real(SHR_KIND_R8) :: precip_fact ! precip factor + character(SHR_KIND_CL) :: rest_case_name ! Short case identification + integer :: unitn ! Namelist unit number to read + logical :: exists ! true if file exists + integer :: ierr ! MPI error return + integer :: rc ! return code + logical :: atm_present ! .true. => atm is present + logical :: lnd_present ! .true. => land is present + logical :: ice_present ! .true. => ice is present + logical :: ocn_present ! .true. => ocn is present + logical :: glc_present ! .true. => glc is present + logical :: glclnd_present ! .true. => glc is computing land coupling + logical :: glcocn_present ! .true. => glc is computing ocean runoff + logical :: glcice_present ! .true. => glc is computing icebergs + logical :: rofice_present ! .true. => rof is computing icebergs + logical :: rof_present ! .true. => rof is present + logical :: flood_present ! .true. => rof is computing flood + logical :: wav_present ! .true. => wav is present + logical :: esp_present ! .true. => esp is present + real(SHR_KIND_R8), parameter :: epsilo = shr_const_mwwv/shr_const_mwdair + character(len=*) , parameter :: u_FILE_u = __FILE__ + character(len=*) , parameter :: sp_str = 'str_undefined' + character(len=*) , parameter :: start_type_start = "startup" + character(len=*) , parameter :: start_type_cont = "continue" + character(len=*) , parameter :: start_type_brnch = "branch" + character(len=*) , parameter :: NLFileName = "drv_in" ! input namelist filename + integer , parameter :: ens1=1 ! use first instance of ensemble only + integer , parameter :: fix1=1 ! temporary hard-coding to first ensemble, needs to be fixed + integer :: eai, eli, eoi, eii, egi, eri, ewi, eei, exi, efi ! component instance counters + + !---------------------------------------------------------- + !| Initialize MCT and MPI communicators and IO + !---------------------------------------------------------- + + call mpi_initialized(flag,ierr) + call shr_mpi_chkerr(ierr,subname//' mpi_initialized') + if (.not. flag) then + call mpi_init(ierr) + call shr_mpi_chkerr(ierr,subname//' mpi_init') + endif + + Global_Comm=MPI_COMM_WORLD + comp_comm = MPI_COMM_NULL + + call shr_pio_init1(num_inst_total,NLFileName, Global_Comm) + ! + ! If pio_async_interface is true Global_Comm is MPI_COMM_NULL on the servernodes + ! and server nodes do not return from shr_pio_init2 + ! + ! if (Global_Comm /= MPI_COMM_NULL) then + + call seq_comm_init(Global_Comm, NLFileName) + + !--- set task based threading counts --- + call seq_comm_getinfo(GLOID,pethreads=pethreads_GLOID,iam=iam_GLOID) + call seq_comm_setnthreads(pethreads_GLOID) + + !--- get some general data --- + it=1 + call seq_comm_getinfo(GLOID,mpicom=mpicom_GLOID,& + iamroot=iamroot_GLOID,nthreads=nthreads_GLOID) + if (iamroot_GLOID) output_perf = .true. + + call seq_comm_getinfo(CPLID,mpicom=mpicom_CPLID,& + iamroot=iamroot_CPLID,nthreads=nthreads_CPLID,& + iam=comp_comm_iam(it)) + if (iamroot_CPLID) output_perf = .true. + + if (iamin_CPLID) complist = trim(complist)//' cpl' + + comp_id(it) = CPLID + comp_comm(it) = mpicom_CPLID + iamin_CPLID = seq_comm_iamin(CPLID) + comp_iamin(it) = seq_comm_iamin(comp_id(it)) + comp_name(it) = seq_comm_name(comp_id(it)) + + do eai = 1,num_inst_atm + it=it+1 + comp_id(it) = ATMID(eai) + comp_iamin(it) = seq_comm_iamin(comp_id(it)) + comp_name(it) = seq_comm_name(comp_id(it)) + call seq_comm_getinfo(ATMID(eai), mpicom=comp_comm(it), & + nthreads=nthreads_ATMID, iam=comp_comm_iam(it)) + if (seq_comm_iamin(ATMID(eai))) then + complist = trim(complist)//' '//trim(seq_comm_name(ATMID(eai))) + endif + if (seq_comm_iamroot(ATMID(eai))) output_perf = .true. + enddo + call seq_comm_getinfo(CPLALLATMID, mpicom=mpicom_CPLALLATMID) + iamin_CPLALLATMID = seq_comm_iamin(CPLALLATMID) + + do eli = 1,num_inst_lnd + it=it+1 + comp_id(it) = LNDID(eli) + comp_iamin(it) = seq_comm_iamin(comp_id(it)) + comp_name(it) = seq_comm_name(comp_id(it)) + call seq_comm_getinfo(LNDID(eli), mpicom=comp_comm(it), & + nthreads=nthreads_LNDID, iam=comp_comm_iam(it)) + if (seq_comm_iamin(LNDID(eli))) then + complist = trim(complist)//' '//trim(seq_comm_name(LNDID(eli))) + endif + if (seq_comm_iamroot(LNDID(eli))) output_perf = .true. + enddo + call seq_comm_getinfo(CPLALLLNDID, mpicom=mpicom_CPLALLLNDID) + iamin_CPLALLLNDID = seq_comm_iamin(CPLALLLNDID) + + do eoi = 1,num_inst_ocn + it=it+1 + comp_id(it) = OCNID(eoi) + comp_iamin(it) = seq_comm_iamin(comp_id(it)) + comp_name(it) = seq_comm_name(comp_id(it)) + call seq_comm_getinfo(OCNID(eoi), mpicom=comp_comm(it), & + nthreads=nthreads_OCNID, iam=comp_comm_iam(it)) + if (seq_comm_iamin (OCNID(eoi))) then + complist = trim(complist)//' '//trim(seq_comm_name(OCNID(eoi))) + endif + if (seq_comm_iamroot(OCNID(eoi))) output_perf = .true. + enddo + call seq_comm_getinfo(CPLALLOCNID, mpicom=mpicom_CPLALLOCNID) + iamin_CPLALLOCNID = seq_comm_iamin(CPLALLOCNID) + + do eii = 1,num_inst_ice + it=it+1 + comp_id(it) = ICEID(eii) + comp_iamin(it) = seq_comm_iamin(comp_id(it)) + comp_name(it) = seq_comm_name(comp_id(it)) + call seq_comm_getinfo(ICEID(eii), mpicom=comp_comm(it), & + nthreads=nthreads_ICEID, iam=comp_comm_iam(it)) + if (seq_comm_iamin (ICEID(eii))) then + complist = trim(complist)//' '//trim(seq_comm_name(ICEID(eii))) + endif + if (seq_comm_iamroot(ICEID(eii))) output_perf = .true. + enddo + call seq_comm_getinfo(CPLALLICEID, mpicom=mpicom_CPLALLICEID) + iamin_CPLALLICEID = seq_comm_iamin(CPLALLICEID) + + do egi = 1,num_inst_glc + it=it+1 + comp_id(it) = GLCID(egi) + comp_iamin(it) = seq_comm_iamin(comp_id(it)) + comp_name(it) = seq_comm_name(comp_id(it)) + call seq_comm_getinfo(GLCID(egi), mpicom=comp_comm(it), nthreads=nthreads_GLCID, iam=comp_comm_iam(it)) + if (seq_comm_iamin (GLCID(egi))) then + complist = trim(complist)//' '//trim(seq_comm_name(GLCID(egi))) + endif + if (seq_comm_iamroot(GLCID(egi))) output_perf = .true. + enddo + call seq_comm_getinfo(CPLALLGLCID, mpicom=mpicom_CPLALLGLCID) + iamin_CPLALLGLCID = seq_comm_iamin(CPLALLGLCID) + + do eri = 1,num_inst_rof + it=it+1 + comp_id(it) = ROFID(eri) + comp_iamin(it) = seq_comm_iamin(comp_id(it)) + comp_name(it) = seq_comm_name(comp_id(it)) + call seq_comm_getinfo(ROFID(eri), mpicom=comp_comm(it), & + nthreads=nthreads_ROFID, iam=comp_comm_iam(it)) + if (seq_comm_iamin(ROFID(eri))) then + complist = trim(complist)//' '//trim( seq_comm_name(ROFID(eri))) + endif + if (seq_comm_iamroot(ROFID(eri))) output_perf = .true. + enddo + call seq_comm_getinfo(CPLALLROFID, mpicom=mpicom_CPLALLROFID) + iamin_CPLALLROFID = seq_comm_iamin(CPLALLROFID) + + do ewi = 1,num_inst_wav + it=it+1 + comp_id(it) = WAVID(ewi) + comp_iamin(it) = seq_comm_iamin(comp_id(it)) + comp_name(it) = seq_comm_name(comp_id(it)) + call seq_comm_getinfo(WAVID(ewi), mpicom=comp_comm(it), & + nthreads=nthreads_WAVID, iam=comp_comm_iam(it)) + if (seq_comm_iamin(WAVID(ewi))) then + complist = trim(complist)//' '//trim(seq_comm_name(WAVID(ewi))) + endif + if (seq_comm_iamroot(WAVID(ewi))) output_perf = .true. + enddo + call seq_comm_getinfo(CPLALLWAVID, mpicom=mpicom_CPLALLWAVID) + iamin_CPLALLWAVID = seq_comm_iamin(CPLALLWAVID) + + do eei = 1,num_inst_esp + it=it+1 + comp_id(it) = ESPID(eei) + comp_iamin(it) = seq_comm_iamin(comp_id(it)) + comp_name(it) = seq_comm_name(comp_id(it)) + call seq_comm_getinfo(ESPID(eei), mpicom=comp_comm(it), & + nthreads=nthreads_ESPID, iam=comp_comm_iam(it)) + if (seq_comm_iamin (ESPID(eei))) then + complist = trim(complist)//' '//trim(seq_comm_name(ESPID(eei))) + endif + enddo + ! ESP components do not use the coupler (they are 'external') + + !---------------------------------------------------------- + !| Set logging parameters both for shr code and locally + !---------------------------------------------------------- + + if (iamroot_CPLID) then + inquire(file='cpl_modelio.nml',exist=exists) + if (exists) then + logunit = shr_file_getUnit() + call shr_file_setIO('cpl_modelio.nml',logunit) + call shr_file_setLogUnit(logunit) + loglevel = 1 + call shr_file_setLogLevel(loglevel) + endif + else + loglevel = 0 + call shr_file_setLogLevel(loglevel) + endif + + !---------------------------------------------------------- + ! Log info about the environment settings + !---------------------------------------------------------- + + ! When using io servers (pio_async_interface=.true.) the server tasks do not return from + ! shr_pio_init2 + + call shr_pio_init2(comp_id,comp_name,comp_iamin,comp_comm,comp_comm_iam) + + !---------------------------------------------------------- + ! Print Model heading and copyright message + !---------------------------------------------------------- + + ! MV: if (iamroot_CPLID) call seq_cesm_printlogheader() + + !---------------------------------------------------------- + !| Timer initialization (has to be after mpi init) + !---------------------------------------------------------- + + maxthreads = max(nthreads_GLOID,nthreads_CPLID,nthreads_ATMID, & + nthreads_LNDID,nthreads_ICEID,nthreads_OCNID,nthreads_GLCID, & + nthreads_ROFID, nthreads_WAVID, nthreads_ESPID, pethreads_GLOID ) + + call t_initf(NLFileName, LogPrint=.true., mpicom=mpicom_GLOID, & + MasterTask=iamroot_GLOID,MaxThreads=maxthreads) + + if (iamin_CPLID) then + ! TODO: where should this be called + ! MV: call seq_io_cpl_init() + endif + + call t_startf('CPL:INIT') + call t_adj_detailf(+1) + + call t_startf('CPL:cesm_init') + + !---------------------------------------------------------- + ! Memory test + !---------------------------------------------------------- + + call shr_mem_init(prt=iamroot_CPLID) + + !---------------------------------------------------------- + ! Initialize infodata + !---------------------------------------------------------- + + call seq_infodata_init1(infodata, driver, GLOID) + + !---------------------------------------------------------- + ! Add atm_aero to driver attributes + !---------------------------------------------------------- + + call NUOPC_CompAttributeAdd(driver, attrList=(/'atm_aero'/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + ! set initial value to .false. + ! Note currently this is a duplicate setting of what is done in infodata + call NUOPC_CompAttributeSet(driver, name='atm_aero', value='.false.', rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + !---------------------------------------------------------- + ! Deterine same grid attributes + !---------------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name="atm_gnam", value=atm_gnam, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeGet(driver, name="lnd_gnam", value=lnd_gnam, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeGet(driver, name="rof_gnam", value=rof_gnam, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeGet(driver, name="ice_gnam", value=ice_gnam, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeGet(driver, name="ocn_gnam", value=ocn_gnam, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeGet(driver, name="wav_gnam", value=wav_gnam, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + samegrid_ao = '.true.' + samegrid_al = '.true.' + samegrid_lr = '.true.' + samegrid_oi = '.true.' + samegrid_ro = '.true.' + samegrid_aw = '.true.' + samegrid_ow = '.true.' + samegrid_lg = '.true.' + samegrid_og = '.true.' + samegrid_ig = '.true.' + samegrid_alo = '.true.' + + ! set samegrid to true for single column + if (.not. single_column) then + if (trim(atm_gnam) /= trim(ocn_gnam)) samegrid_ao = '.false.' + if (trim(atm_gnam) /= trim(lnd_gnam)) samegrid_al = '.false.' + if (trim(lnd_gnam) /= trim(rof_gnam)) samegrid_lr = '.false.' + if (trim(rof_gnam) /= trim(ocn_gnam)) samegrid_ro = '.false.' + if (trim(ocn_gnam) /= trim(ice_gnam)) samegrid_oi = '.false.' + if (trim(atm_gnam) /= trim(wav_gnam)) samegrid_aw = '.false.' + if (trim(ocn_gnam) /= trim(wav_gnam)) samegrid_ow = '.false.' + if (trim(lnd_gnam) /= trim(glc_gnam)) samegrid_lg = '.false.' + if (trim(ocn_gnam) /= trim(glc_gnam)) samegrid_og = '.false.' + if (trim(ice_gnam) /= trim(glc_gnam)) samegrid_ig = '.false.' + if (samegrid_al == '.true.' .and. samegrid_ao == '.true.') then + samegrid_alo = '.true.' + else + samegrid_alo = '.false.' + end if + endif + + call NUOPC_CompAttributeAdd(driver, attrList=(/'samegrid_ao', 'samegrid_al', 'samegrid_lr', & + 'samegrid_oi', 'samegrid_ro', 'samegrid_aw', 'samegrid_ow', 'samegrid_lg', & + 'samegrid_og', 'samegrid_ig', 'samegrid_alo'/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeSet(driver, name="samegrid_ao", value=samegrid_ao, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeSet(driver, name="samegrid_al", value=samegrid_al, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeSet(driver, name="samegrid_lr", value=samegrid_lr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeSet(driver, name="samegrid_oi", value=samegrid_oi, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeSet(driver, name="samegrid_ro", value=samegrid_ro, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeSet(driver, name="samegrid_aw", value=samegrid_aw, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeSet(driver, name="samegrid_ow", value=samegrid_ow, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeSet(driver, name="samegrid_lg", value=samegrid_lg, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeSet(driver, name="samegrid_og", value=samegrid_og, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeSet(driver, name="samegrid_ig", value=samegrid_ig, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeSet(driver, name="samegrid_alo", value=samegrid_alo, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + !---------------------------------------------------------- + ! Check consistency of driver attributes + !---------------------------------------------------------- + + call driver_attributes_check(driver) + + !---------------------------------------------------------- + ! Initialize coupled fields (depends on infodata) + !---------------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name="cime_model", value=cime_model, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call NUOPC_CompAttributeGet(driver, name="cime_model", value=cime_model, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + if ( trim(cime_model) /= 'acme' .and. trim(cime_model) /= 'cesm') then + call shr_sys_abort( subname//': cime_model must be set to acme or cesm, aborting') + end if + + call seq_flds_set(nlfilename, GLOID, cime_model) + + !---------------------------------------------------------- + ! Initialize dopole flag (as a module variable in shr_map_mod) + !---------------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name="shr_map_dopole", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) shr_map_dopole + + call shr_map_setDopole(shr_map_dopole) + + !---------------------------------------------------------- + ! Initialize options for reproducible sums + !---------------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name="reprosum_use_ddpdd", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) reprosum_use_ddpdd + + call NUOPC_CompAttributeGet(driver, name="reprosum_diffmax", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) reprosum_diffmax + + call NUOPC_CompAttributeGet(driver, name="reprosum_recompute", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) reprosum_recompute + + call shr_reprosum_setopts(repro_sum_use_ddpdd_in=reprosum_use_ddpdd, & + repro_sum_rel_diff_max_in=reprosum_diffmax, repro_sum_recompute_in=reprosum_recompute) + + !---------------------------------------------------------- + ! Check cpl_seq_option + !---------------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name="cpl_seq_option", value=cpl_seq_option, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + if (trim(cpl_seq_option) /= 'CESM1_ORIG' .and. & + trim(cpl_seq_option) /= 'CESM1_ORIG_TIGHT' .and. & + trim(cpl_seq_option) /= 'CESM1_MOD' .and. & + trim(cpl_seq_option) /= 'CESM1_MOD_TIGHT' .and. & + trim(cpl_seq_option) /= 'RASM_OPTION1' .and. & + trim(cpl_seq_option) /= 'RASM_OPTION2' ) then + call shr_sys_abort(subname//' invalid cpl_seq_option = '//trim(cpl_seq_option)) + endif + + !---------------------------------------------------------- + ! Test Threading Setup in driver happens to be valid on all pes for all IDs + !---------------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name="drv_threading", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) drv_threading + + if (drv_threading) then + if (iamroot_GLOID) write(logunit,*) ' ' + if (iamroot_GLOID) write(logunit,'(2A) ') subname,' Test Threading in driver' + call seq_comm_setnthreads(nthreads_GLOID) + if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_GLOID = ',nthreads_GLOID,seq_comm_getnthreads() + call seq_comm_setnthreads(nthreads_CPLID) + if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_CPLID = ',nthreads_CPLID,seq_comm_getnthreads() + call seq_comm_setnthreads(nthreads_ATMID) + if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_ATMID = ',nthreads_ATMID,seq_comm_getnthreads() + call seq_comm_setnthreads(nthreads_LNDID) + if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_LNDID = ',nthreads_LNDID,seq_comm_getnthreads() + call seq_comm_setnthreads(nthreads_OCNID) + if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_OCNID = ',nthreads_OCNID,seq_comm_getnthreads() + call seq_comm_setnthreads(nthreads_ICEID) + if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_ICEID = ',nthreads_ICEID,seq_comm_getnthreads() + call seq_comm_setnthreads(nthreads_GLCID) + if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_GLCID = ',nthreads_GLCID,seq_comm_getnthreads() + call seq_comm_setnthreads(nthreads_ROFID) + if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_ROFID = ',nthreads_ROFID,seq_comm_getnthreads() + call seq_comm_setnthreads(nthreads_WAVID) + if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_WAVID = ',nthreads_WAVID,seq_comm_getnthreads() + call seq_comm_setnthreads(nthreads_ESPID) + if (iamroot_GLOID) write(logunit,'(2A,2I4)') subname,' nthreads_ESPID = ',nthreads_ESPID,seq_comm_getnthreads() + if (iamroot_GLOID) write(logunit,*) ' ' + call seq_comm_setnthreads(nthreads_GLOID) + endif + + !----------------------------------------------------- + ! Determine if restart is read + !----------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name='start_type', value=start_type, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + ! Check valid values of start type + call NUOPC_CompAttributeGet(driver, name="start_type", value=start_type, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + if ((trim(start_type) /= start_type_start) .and. & + (trim(start_type) /= start_type_cont ) .and. & + (trim(start_type) /= start_type_brnch)) then + call shr_sys_abort(subname//': start_type invalid = '//trim(start_type)) + end if + + read_restart = .false. + if (trim(start_type) == trim(start_type_cont) .or. trim(start_type) == trim(start_type_brnch)) then + read_restart = .true. + endif + + ! Add rest_case_name and read_restart to driver attributes + call NUOPC_CompAttributeAdd(driver, attrList=(/'rest_case_name','read_restart'/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + rest_case_name = ' ' + call NUOPC_CompAttributeSet(driver, name='rest_case_name', value=rest_case_name, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + write(cvalue,*) read_restart + call NUOPC_CompAttributeSet(driver, name='read_restart', value=trim(cvalue), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + !----------------------------------------------------- + ! Read Restart (seq_io_read must be called on all pes) + !----------------------------------------------------- + + ! Error check on restart_pfile + call NUOPC_CompAttributeGet(driver, name="restart_pfile", value=restart_pfile, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + if ( len_trim(restart_pfile) == 0 ) then + call shr_sys_abort( subname//': restart_pfile must be set' ) + end if + + if (read_restart) then + !--- read rpointer if restart_file is set to sp_str --- + if (seq_comm_iamroot(GLOID)) then + + call NUOPC_CompAttributeGet(driver, name='restart_file', value=restart_file, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + if (trim(restart_file) == trim(sp_str)) then + ! Read pointer file + + call NUOPC_CompAttributeGet(driver, name='restart_pfile', value=restart_file, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + unitn = shr_file_getUnit() + if (loglevel > 0) write(logunit,"(3A)") subname," read rpointer file ", trim(restart_pfile) + open(unitn, file=restart_pfile, form='FORMATTED', status='old',iostat=ierr) + if (ierr < 0) then + call shr_sys_abort( subname//':: rpointer file open returns an'// ' error condition' ) + end if + read(unitn,'(a)', iostat=ierr) restart_file + if (ierr < 0) then + call shr_sys_abort( subname//':: rpointer file read returns an'// ' error condition' ) + end if + close(unitn) + call shr_file_freeUnit( unitn ) + write(logunit,"(3A)") subname,' restart file from rpointer= ', trim(restart_file) + endif + endif + call shr_mpi_bcast(restart_file,mpicom_GLOID) + + call NUOPC_CompAttributeSet(driver, name='restart_pfile', value=restart_file, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + !--- NOTE: use CPLID here because seq_io is only value on CPLID + if (seq_comm_iamin(CPLID)) then + call seq_io_read(restart_file, pioid, nextsw_cday , 'seq_infodata_nextsw_cday') + call seq_io_read(restart_file, pioid, precip_fact , 'seq_infodata_precip_fact') + call seq_io_read(restart_file ,pioid ,rest_case_name, 'seq_infodata_case_name' ) + endif + + !--- Send from CPLID ROOT to GLOBALID ROOT, use bcast as surrogate + call shr_mpi_bcast(nextsw_cday ,mpicom_GLOID, pebcast=seq_comm_gloroot(CPLID)) + call shr_mpi_bcast(precip_fact ,mpicom_GLOID, pebcast=seq_comm_gloroot(CPLID)) + call shr_mpi_bcast(rest_case_name ,mpicom_GLOID, pebcast=seq_comm_gloroot(CPLID)) + + call seq_infodata_putData(infodata, & + nextsw_cday=nextsw_cday, & + precip_fact=precip_fact, & + rest_case_name=rest_case_name) + endif + + !---------------------------------------------------------- + ! Initialize time manager + !---------------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name='read_restart', value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) read_restart + + call NUOPC_CompAttributeGet(driver, name="restart_file", value=restart_file, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call seq_timemgr_clockInit(seq_SyncClock, nlfilename, & + read_restart, restart_file, pioid, mpicom_gloid, & + EClock_d, EClock_a, EClock_l, EClock_o, & + EClock_i, Eclock_g, Eclock_r, Eclock_w, Eclock_e) + + if (iamroot_CPLID) then + call seq_timemgr_clockPrint(seq_SyncClock) + endif + + !---------------------------------------------------------- + ! Initialize infodata items which need the clocks + !---------------------------------------------------------- + + call seq_infodata_init2(infodata) + + !---------------------------------------------------------- + ! Initialize freezing point calculation for all components + !---------------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name="tfreeze_option", value=tfreeze_option, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + call shr_frz_freezetemp_init(tfreeze_option) + + !---------------------------------------------------------- + ! Initialize orbital related values + !---------------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name="orb_mode", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) orb_mode + + call NUOPC_CompAttributeGet(driver, name="orb_iyear", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) orb_iyear + + call NUOPC_CompAttributeGet(driver, name="orb_iyear_align", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) orb_iyear_align + + call NUOPC_CompAttributeGet(driver, name="orb_obliq", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) orb_obliq + + call NUOPC_CompAttributeGet(driver, name="orb_eccen", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) orb_eccen + + call NUOPC_CompAttributeGet(driver, name="orb_mvelp", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) orb_mvelp + + if (trim(orb_mode) == trim(seq_infodata_orb_fixed_year)) then + orb_obliq = SHR_ORB_UNDEF_REAL + orb_eccen = SHR_ORB_UNDEF_REAL + orb_mvelp = SHR_ORB_UNDEF_REAL + if (orb_iyear == SHR_ORB_UNDEF_INT) then + write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) trim(subname),' ERROR: fixed_year settings = ',orb_iyear + call shr_sys_abort(subname//' ERROR: invalid settings for orb_mode '//trim(orb_mode)) + endif + + elseif (trim(orb_mode) == trim(seq_infodata_orb_variable_year)) then + orb_obliq = SHR_ORB_UNDEF_REAL + orb_eccen = SHR_ORB_UNDEF_REAL + orb_mvelp = SHR_ORB_UNDEF_REAL + if (orb_iyear == SHR_ORB_UNDEF_INT .or. orb_iyear_align == SHR_ORB_UNDEF_INT) then + write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) trim(subname),' ERROR: variable_year settings = ',orb_iyear, orb_iyear_align + call shr_sys_abort(subname//' ERROR: invalid settings for orb_mode '//trim(orb_mode)) + endif + + elseif (trim(orb_mode) == trim(seq_infodata_orb_fixed_parameters)) then + !-- force orb_iyear to undef to make sure shr_orb_params works properly + orb_iyear = SHR_ORB_UNDEF_INT + orb_iyear_align = SHR_ORB_UNDEF_INT + if (orb_eccen == SHR_ORB_UNDEF_REAL .or. & + orb_obliq == SHR_ORB_UNDEF_REAL .or. & + orb_mvelp == SHR_ORB_UNDEF_REAL) then + write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) trim(subname),' ERROR: orb_eccen = ',orb_eccen + write(logunit,*) trim(subname),' ERROR: orb_obliq = ',orb_obliq + write(logunit,*) trim(subname),' ERROR: orb_mvelp = ',orb_mvelp + call shr_sys_abort(subname//' ERROR: invalid settings for orb_mode '//trim(orb_mode)) + endif + else + call shr_sys_abort(subname//' ERROR: invalid orb_mode '//trim(orb_mode)) + endif + + ! Determine orbital params + + if (trim(orb_mode) == trim(seq_infodata_orb_variable_year)) then + call seq_timemgr_EClockGetData( EClock_d, curr_ymd=ymd) + call shr_cal_date2ymd(ymd,year,month,day) + orb_cyear = orb_iyear + (year - orb_iyear_align) + call shr_orb_params(orb_cyear, orb_eccen, orb_obliq, orb_mvelp, & + orb_obliqr, orb_lambm0, orb_mvelpp, iamroot_CPLID) + else + call shr_orb_params(orb_iyear, orb_eccen, orb_obliq, orb_mvelp, & + orb_obliqr, orb_lambm0, orb_mvelpp, iamroot_CPLID) + end if + + if (orb_eccen == SHR_ORB_UNDEF_REAL .or. & + orb_obliqr == SHR_ORB_UNDEF_REAL .or. & + orb_mvelpp == SHR_ORB_UNDEF_REAL .or. & + orb_lambm0 == SHR_ORB_UNDEF_REAL) then + call shr_sys_abort(subname//': orb params incorrect') + endif + + ! Add updated orbital params to driver attributes + + call NUOPC_CompAttributeAdd(driver, attrList=(/'orb_obliqr', 'orb_lambm0', 'orb_mvelpp'/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + write(cvalue,*) orb_eccen + call NUOPC_CompAttributeSet(driver, name="orb_eccen", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + write(cvalue,*) orb_obliqr + call NUOPC_CompAttributeSet(driver, name="orb_obliqr", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + write(cvalue,*) orb_lambm0 + call NUOPC_CompAttributeSet(driver, name="orb_lambm0", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + write(cvalue,*) orb_mvelpp + call NUOPC_CompAttributeSet(driver, name="orb_mvelpp", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + !---------------------------------------------------------- + ! Initialize water vapor info + !---------------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name="wv_sat_scheme", value=wv_sat_scheme, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + if (.not. shr_wv_sat_valid_idx(shr_wv_sat_get_scheme_idx(trim(wv_sat_scheme)))) then + call shr_sys_abort(subname//': "'//trim(wv_sat_scheme)//'" is not a recognized saturation vapor pressure scheme name') + end if + if (.not. shr_wv_sat_set_default(wv_sat_scheme)) then + call shr_sys_abort('Invalid wv_sat_scheme.') + end if + + call NUOPC_CompAttributeGet(driver, name="wv_sat_transition_start", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) wv_sat_transition_start + + call shr_assert_in_domain(wv_sat_transition_start, & + ge=0._SHR_KIND_R8, le=40._SHR_KIND_R8, & + varname="wv_sat_transition_start", msg="Invalid transition temperature range.") + + call NUOPC_CompAttributeGet(driver, name="wv_sat_use_tables", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) wv_sat_use_tables + + call NUOPC_CompAttributeGet(driver, name="wv_sat_table_spacing", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) wv_sat_table_spacing + + ! A transition range averaging method in CAM is only valid for: + ! -40 deg C <= T <= 0 deg C + ! shr_wv_sat_mod itself checks for values with the wrong sign, but we + ! have to check that the range is no more than 40 deg C here. Even + ! though this is a CAM-specific restriction, it's not really likely + ! that any other parameterization will be dealing with mixed-phase + ! water below 40 deg C anyway. + + call shr_wv_sat_init(shr_const_tkfrz, shr_const_tktrip, wv_sat_transition_start, epsilo, errstring) + if (errstring /= "") then + call shr_sys_abort('shr_wv_sat_init: '//trim(errstring)) + end if + + ! The below produces internal lookup tables in the range 175-374K for + ! liquid water, and 125-274K for ice, with a resolution set by the + ! option wv_sat_table_spacing. + ! In theory these ranges could be specified in the namelist, but in + ! practice users will want to change them *very* rarely if ever, which + ! is why only the spacing is in the namelist. + + if (wv_sat_use_tables) then + liquid_spec = ShrWVSatTableSpec(ceiling(200._SHR_KIND_R8/wv_sat_table_spacing), 175._SHR_KIND_R8, wv_sat_table_spacing) + ice_spec = ShrWVSatTableSpec(ceiling(150._SHR_KIND_R8/wv_sat_table_spacing), 125._SHR_KIND_R8, wv_sat_table_spacing) + mixed_spec = ShrWVSatTableSpec(ceiling(250._SHR_KIND_R8/wv_sat_table_spacing), 125._SHR_KIND_R8, wv_sat_table_spacing) + call shr_wv_sat_make_tables(liquid_spec, ice_spec, mixed_spec) + end if + + !---------------------------------------------------------- + ! Set single_column flags + ! If in single column mode, overwrite flags according to focndomain file + ! in ocn_in namelist. SCAM can reset the "present" flags for lnd, + ! ocn, ice, rof, and flood. + !---------------------------------------------------------- + + call NUOPC_CompAttributeGet(driver, name="single_column", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) single_column + + call seq_infodata_getData( infodata, aqua_planet=aqua_planet) + + if (.not.aqua_planet .and. single_column) then + + call NUOPC_CompAttributeGet(driver, name="scmlon", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) scmlon + + call NUOPC_CompAttributeGet(driver, name="scmlat", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + read(cvalue,*) scmlat + + call seq_infodata_GetData(infodata, & + atm_present=atm_present , & + lnd_present=lnd_present , & + ice_present=ice_present , & + ocn_present=ocn_present , & + glc_present=glc_present , & + rof_present=rof_present , & + wav_present=wav_present , & + esp_present=esp_present) + + call seq_comm_getinfo(OCNID(ens1), mpicom=mpicom_OCNID) + + call shr_scam_checkSurface(scmlon, scmlat, & + OCNID(ens1), mpicom_OCNID, & + lnd_present=lnd_present, & + ocn_present=ocn_present, & + ice_present=ice_present, & + rof_present=rof_present, & + flood_present=flood_present, & + rofice_present=rofice_present) + + call seq_infodata_putData(infodata, & + lnd_present=lnd_present, & + ocn_present=ocn_present, & + ice_present=ice_present, & + rof_present=rof_present, & + flood_present=flood_present, & + rofice_present=rofice_present) + endif + + !---------------------------------------------------------- + ! Finalize initialization + !---------------------------------------------------------- + + if(PIO_FILE_IS_OPEN(pioid)) then + call pio_closefile(pioid) + endif + + call t_stopf('CPL:cesm_init') + + call t_adj_detailf(-1) + call t_stopf('CPL:INIT') + + end subroutine cesm_init + + !=============================================================================== + subroutine driver_attributes_check( driver ) + + ! !DESCRIPTION: Check that input driver config values have reasonable values + + ! !USES: + + implicit none + + ! !INPUT/OUTPUT PARAMETERS: + type(ESMF_GridComp) , intent(INOUT) :: driver + + !----- local ----- + integer :: lastchar ! Last character index + character(SHR_KIND_CL) :: start_type ! Type of startup + character(SHR_KIND_CL) :: rest_case_name ! Short case identification + character(SHR_KIND_CL) :: case_name ! Short case identification + character(SHR_KIND_CS) :: aoflux_grid ! grid for atm ocn flux calc + character(SHR_KIND_CL) :: vect_map ! vector mapping option, none, cart3d, cart3d_diag, cart3d_uvw, cart3d_uvw_diag + character(SHR_KIND_CS) :: logFilePostFix ! postfix for output log files + character(SHR_KIND_CL) :: outPathRoot ! root for output log files + character(SHR_KIND_CL) :: cvalue ! temporary + integer :: rc ! return code + character(len=*), parameter :: u_FILE_u = __FILE__ + character(len=*), parameter :: subname = '(driver_attributes_check) ' + !------------------------------------------------------------------------------- + + ! --- Case name ------ + call NUOPC_CompAttributeGet(driver, name="case_name", value=case_name, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + lastchar = len(case_name) + if ( len_trim(case_name) == 0) then + call shr_sys_abort( subname//': variable case_name must be set, aborting') + end if + if (case_name(lastchar:lastchar) /= ' ') then + write(logunit,"(A,I4,A)")'ERROR: case_name must not exceed ', len(case_name)-1,' characters' + call shr_sys_abort( subname//': variable case_name must be set, aborting') + end if + + ! --- LogFile ending name ----- + call NUOPC_CompAttributeGet(driver, name="logFilePostFix", value=logFilePostFix, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort + + if ( len_trim(logFilePostFix) == 0 ) then + call shr_sys_abort( subname//': logFilePostFix must be set to something not blank' ) + end if + + ! --- Output path root directory ----- + call NUOPC_CompAttributeGet(driver, name="outPathRoot", value=outPathRoot, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort + + if ( len_trim(outPathRoot) == 0 ) then + call shr_sys_abort( subname//': outPathRoot must be set' ) + end if + if ( index(outPathRoot, "/", back=.true.) /= len_trim(outPathRoot) ) then + call shr_sys_abort( subname//': outPathRoot must end with a slash' ) + end if + + ! --- Grid for atm/ocean flux computations ---- + call NUOPC_CompAttributeGet(driver, name="aoflux_grid", value=aoflux_grid, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + if ((trim(aoflux_grid) /= 'ocn') .and. & + (trim(aoflux_grid) /= 'atm') .and. & + (trim(aoflux_grid) /= 'exch')) then + write(logunit,'(2a)') 'ERROR aoflux_grid not supported = ',trim(aoflux_grid) + call shr_sys_abort(subname//': aoflux_grid invalid = '//trim(aoflux_grid)) + endif + + ! --- Vector mapping options ---- + call NUOPC_CompAttributeGet(driver, name="vect_map", value=vect_map, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + if ((trim(vect_map) /= 'none') .and. & + (trim(vect_map) /= 'cart3d') .and. & + (trim(vect_map) /= 'cart3d_diag') .and. & + (trim(vect_map) /= 'cart3d_uvw') .and. & + (trim(vect_map) /= 'cart3d_uvw_diag')) then + write(logunit,'(2a)') 'ERROR vect_map not supported = ',trim(vect_map) + call shr_sys_abort(subname//': vect_map invalid = '//trim(vect_map)) + endif + + ! --- Case name and restart case name ------ + ! call NUOPC_CompAttributeGet(driver, name="rest_case_name", value=rest_case_name, rc=rc) + ! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) call shr_sys_abort() + + ! if ((trim(start_type) == start_type_cont ) .and. (trim(case_name) /= trim(rest_case_name))) then + ! write(logunit,'(10a)') subname,' case_name =',trim(case_name),':',' rest_case_name =',trim(rest_case_name),':' + ! call shr_sys_abort(subname//': invalid continue restart case name = '//trim(rest_case_name)) + ! endif + + end subroutine driver_attributes_check + +end module cesm_init_mod diff --git a/src/drivers/nuopc/main/esm.F90 b/src/drivers/nuopc/cime_driver/esm.F90 similarity index 77% rename from src/drivers/nuopc/main/esm.F90 rename to src/drivers/nuopc/cime_driver/esm.F90 index e4c0ee18ab6..9d591d411e8 100644 --- a/src/drivers/nuopc/main/esm.F90 +++ b/src/drivers/nuopc/cime_driver/esm.F90 @@ -87,65 +87,35 @@ module ESM use xesp_comp_nuopc, only: xesp_SS => SetServices #endif -#ifdef ESMFUSE_satm - use satm_comp_nuopc, only: satm_SS => SetServices -#endif -#ifdef ESMFUSE_socn - use socn_comp_nuopc, only: socn_SS => SetServices -#endif -#ifdef ESMFUSE_sice - use sice_comp_nuopc, only: sice_SS => SetServices -#endif -#ifdef ESMFUSE_slnd - use slnd_comp_nuopc, only: slnd_SS => SetServices -#endif -#ifdef ESMFUSE_srof - use srof_comp_nuopc, only: srof_SS => SetServices -#endif -#ifdef ESMFUSE_swav - use swav_comp_nuopc, only: swav_SS => SetServices -#endif -#ifdef ESMFUSE_sglc - use sglc_comp_nuopc, only: sglc_SS => SetServices -#endif -#ifdef ESMFUSE_sesp - use sesp_comp_nuopc, only: sesp_SS => SetServices -#endif - + use MED , only: med_SS => SetServices + use NUOPC_Connector , only: cpl_SS => SetServices - use MED , only: med_SS => SetServices - use NUOPC_Connector, only: cpl_SS => SetServices + use shr_kind_mod , only: r8 => SHR_KIND_R8 + use shr_kind_mod , only: CL => SHR_KIND_CL - use shr_kind_mod,only : r8 => SHR_KIND_R8 - use shr_kind_mod,only : CL => SHR_KIND_CL - - use seq_comm_mct , only: CPLID, GLOID, logunit, loglevel - use seq_comm_mct , only: ATMID, LNDID, OCNID, ICEID, GLCID, ROFID, WAVID, ESPID + use seq_comm_mct , only: CPLID, GLOID, logunit, loglevel + use seq_comm_mct , only: ATMID, LNDID, OCNID, ICEID, GLCID, ROFID, WAVID, ESPID #if (1 == 0) - use seq_comm_mct , only: num_inst_atm, num_inst_lnd, num_inst_rof - use seq_comm_mct , only: num_inst_ocn, num_inst_ice, num_inst_glc - use seq_comm_mct , only: num_inst_wav, num_inst_esp, num_inst_total - use seq_comm_mct , only: seq_comm_init -#endif - use seq_comm_mct , only: seq_comm_petlist - use seq_infodata_mod, only: infodata=>seq_infodata_infodata - use seq_infodata_mod, only: seq_infodata_putData, seq_infodata_GetData - use cesm_comp_mod, only: cesm_pre_init1, cesm_pre_init2 - use seq_timemgr_mod, only: seq_timemgr_EClock_d, seq_timemgr_EClock_a, seq_timemgr_EClock_o - use shr_nuopc_fldList_mod, only: shr_nuopc_fldList_setDict_fromseqflds - use shr_nuopc_methods_mod, only: shr_nuopc_methods_Clock_TimePrint - use shr_nuopc_methods_mod, only: shr_nuopc_methods_ChkErr + use seq_comm_mct , only: num_inst_atm, num_inst_lnd, num_inst_rof + use seq_comm_mct , only: num_inst_ocn, num_inst_ice, num_inst_glc + use seq_comm_mct , only: num_inst_wav, num_inst_esp, num_inst_total + use seq_comm_mct , only: seq_comm_init +#endif + use seq_comm_mct , only: seq_comm_petlist + use cesm_init_mod , only: cesm_init + use seq_timemgr_mod , only: seq_timemgr_EClock_d, seq_timemgr_EClock_a, seq_timemgr_EClock_o + use shr_nuopc_fldList_mod , only: shr_nuopc_fldList_setDict_fromseqflds + use shr_nuopc_methods_mod , only: shr_nuopc_methods_Clock_TimePrint + use shr_nuopc_methods_mod , only: shr_nuopc_methods_ChkErr implicit none include 'mpif.h' - integer, parameter :: dbug_flag = 10 - character(len=512) :: msgstr - integer :: dbrc - character(*), parameter :: NLFileName = "drv_in" ! input namelist filename + integer, parameter :: dbug_flag = 10 + character(len=512) :: msgstr + integer :: dbrc character(*), parameter :: runseq_filename = "cesm.runconfig" - character(*), parameter :: u_FILE_u = & - __FILE__ + character(*), parameter :: u_FILE_u = __FILE__ private @@ -228,21 +198,13 @@ subroutine SetModelServices(driver, rc) integer :: componentCount type(NUOPC_FreeFormat) :: attrFF character(len=*), parameter :: subname = "(esm.F90:SetModelServices)" + !------------------------------------------- rc = ESMF_SUCCESS if (dbug_flag > 5) then call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO, rc=dbrc) endif - !------------------------------------------- - ! Initialize mct and pets and cesm stuff - !------------------------------------------- - - call cesm_pre_init1() - call cesm_pre_init2() - call shr_nuopc_fldList_setDict_fromseqflds(rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - !------------------------------------------- ! Read components from config file !------------------------------------------- @@ -259,13 +221,51 @@ subroutine SetModelServices(driver, rc) call ESMF_ConfigGetAttribute(config, valueList=compLabels, label="CESM_component_list:", count=componentCount, rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - attrFF = NUOPC_FreeFormatCreate(config, label="driverAttributes::", rc=rc) + attrFF = NUOPC_FreeFormatCreate(config, label="DRIVER_attributes::", rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_FreeFormatPrint(attrFF, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeIngest(driver, attrFF, addFlag=.true., rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + + attrFF = NUOPC_FreeFormatCreate(config, label="DRIVER_info_attributes::", rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_FreeFormatPrint(attrFF, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeIngest(driver, attrFF, addFlag=.true., rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + + attrFF = NUOPC_FreeFormatCreate(config, label="DRIVER_maps_attributes::", rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_FreeFormatPrint(attrFF, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeIngest(driver, attrFF, addFlag=.true., rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + + attrFF = NUOPC_FreeFormatCreate(config, label="DRIVER_auxhist_attributes::", rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_FreeFormatPrint(attrFF, rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call NUOPC_CompAttributeIngest(driver, attrFF, rc=rc) + call NUOPC_CompAttributeIngest(driver, attrFF, addFlag=.true., rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return call NUOPC_FreeFormatDestroy(attrFF, rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + !------------------------------------------- + ! Initialize mct and pets and cesm stuff + !------------------------------------------- + + call cesm_init(driver) + + call shr_nuopc_fldList_setDict_fromseqflds(rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + !-------- ! determine information for each component and add to the driver !-------- @@ -276,8 +276,7 @@ subroutine SetModelServices(driver, rc) prefix=trim(compLabels(n)) !--- read in model instance name - call ESMF_ConfigGetAttribute(config, model, & - label=trim(prefix)//"_model:", default="none", rc=rc) + call ESMF_ConfigGetAttribute(config, model, label=trim(prefix)//"_model:", default="none", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !--- check that there was a model instance specified @@ -343,16 +342,6 @@ subroutine SetModelServices(driver, rc) msg=subname//' model unavailable = '//trim(prefix)//':'//trim(model), & line=__LINE__, file=u_FILE_u, rcToReturn=rc) return ! bail out -#endif - elseif (trim(model) == "satm") then -#ifdef ESMFUSE_satm - call NUOPC_DriverAddComp(driver, "ATM", satm_SS, petList=petList, comp=child, rc=rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return -#else - call ESMF_LogSetError(ESMF_RC_NOT_VALID, & - msg=subname//' model unavailable = '//trim(prefix)//':'//trim(model), & - line=__LINE__, file=u_FILE_u, rcToReturn=rc) - return ! bail out #endif else call ESMF_LogSetError(ESMF_RC_NOT_VALID, & @@ -362,12 +351,11 @@ subroutine SetModelServices(driver, rc) endif call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call esm_AddAttributes(child, ATMID(1), rc=rc) + call esm_AddAttributes(child, driver, ATMID(1), rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return ! read ATM attributes from config file into FreeFormat - attrFF = NUOPC_FreeFormatCreate(config, label=trim(prefix)//"_Attributes::", & - relaxedflag=.true., rc=rc) + attrFF = NUOPC_FreeFormatCreate(config, label=trim(prefix)//"_Attributes::", relaxedflag=.true., rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return call NUOPC_CompAttributeIngest(child, attrFF, addFlag=.true., rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return @@ -420,16 +408,6 @@ subroutine SetModelServices(driver, rc) msg=subname//' model unavailable = '//trim(prefix)//':'//trim(model), & line=__LINE__, file=u_FILE_u, rcToReturn=rc) return ! bail out -#endif - elseif (trim(model) == "socn") then -#ifdef ESMFUSE_socn - call NUOPC_DriverAddComp(driver, "OCN", socn_SS, petList=petList, comp=child, rc=rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return -#else - call ESMF_LogSetError(ESMF_RC_NOT_VALID, & - msg=subname//' model unavailable = '//trim(prefix)//':'//trim(model), & - line=__LINE__, file=u_FILE_u, rcToReturn=rc) - return ! bail out #endif else call ESMF_LogSetError(ESMF_RC_NOT_VALID, & @@ -439,7 +417,7 @@ subroutine SetModelServices(driver, rc) endif call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call esm_AddAttributes(child, OCNID(1), rc=rc) + call esm_AddAttributes(child, driver, OCNID(1), rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return ! read OCN attributes from config file into FreeFormat @@ -487,16 +465,6 @@ subroutine SetModelServices(driver, rc) msg=subname//' model unavailable = '//trim(prefix)//':'//trim(model), & line=__LINE__, file=u_FILE_u, rcToReturn=rc) return ! bail out -#endif - elseif (trim(model) == "sice") then -#ifdef ESMFUSE_sice - call NUOPC_DriverAddComp(driver, "ICE", sice_SS, petList=petList, comp=child, rc=rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return -#else - call ESMF_LogSetError(ESMF_RC_NOT_VALID, & - msg=subname//' model unavailable = '//trim(prefix)//':'//trim(model), & - line=__LINE__, file=u_FILE_u, rcToReturn=rc) - return ! bail out #endif else call ESMF_LogSetError(ESMF_RC_NOT_VALID, & @@ -506,7 +474,7 @@ subroutine SetModelServices(driver, rc) endif call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call esm_AddAttributes(child, ICEID(1), rc=rc) + call esm_AddAttributes(child, driver, ICEID(1), rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return ! read ICE attributes from config file into FreeFormat @@ -554,16 +522,6 @@ subroutine SetModelServices(driver, rc) msg=subname//' model unavailable = '//trim(prefix)//':'//trim(model), & line=__LINE__, file=u_FILE_u, rcToReturn=rc) return ! bail out -#endif - elseif (trim(model) == "slnd") then -#ifdef ESMFUSE_slnd - call NUOPC_DriverAddComp(driver, "LND", slnd_SS, petList=petList, comp=child, rc=rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return -#else - call ESMF_LogSetError(ESMF_RC_NOT_VALID, & - msg=subname//' model unavailable = '//trim(prefix)//':'//trim(model), & - line=__LINE__, file=u_FILE_u, rcToReturn=rc) - return ! bail out #endif else call ESMF_LogSetError(ESMF_RC_NOT_VALID, & @@ -573,7 +531,7 @@ subroutine SetModelServices(driver, rc) endif call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call esm_AddAttributes(child, LNDID(1), rc=rc) + call esm_AddAttributes(child, driver, LNDID(1), rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return ! read LND attributes from config file into FreeFormat @@ -631,16 +589,6 @@ subroutine SetModelServices(driver, rc) msg=subname//' model unavailable = '//trim(prefix)//':'//trim(model), & line=__LINE__, file=u_FILE_u, rcToReturn=rc) return ! bail out -#endif - elseif (trim(model) == "srof") then -#ifdef ESMFUSE_srof - call NUOPC_DriverAddComp(driver, "ROF", srof_SS, petList=petList, comp=child, rc=rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return -#else - call ESMF_LogSetError(ESMF_RC_NOT_VALID, & - msg=subname//' model unavailable = '//trim(prefix)//':'//trim(model), & - line=__LINE__, file=u_FILE_u, rcToReturn=rc) - return ! bail out #endif else call ESMF_LogSetError(ESMF_RC_NOT_VALID, & @@ -650,7 +598,7 @@ subroutine SetModelServices(driver, rc) endif call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call esm_AddAttributes(child, ROFID(1), rc=rc) + call esm_AddAttributes(child, driver, ROFID(1), rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return ! read ROF attributes from config file into FreeFormat @@ -680,12 +628,35 @@ subroutine SetModelServices(driver, rc) endif call NUOPC_CompAttributeSet(child, name="Verbosity", value="high", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call esm_AddAttributes(child, CPLID, rc=rc) + call esm_AddAttributes(child, driver, CPLID, rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return ! read MED attributes from config file into FreeFormat - attrFF = NUOPC_FreeFormatCreate(config, label=trim(prefix)//"_Attributes::", & - relaxedflag=.true., rc=rc) + attrFF = NUOPC_FreeFormatCreate(config, label=trim(prefix)//"_Attributes::", relaxedflag=.true., rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeIngest(child, attrFF, addFlag=.true., rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + + ! for now read DRIVER_info_attributes from config file into FreeFormat + attrFF = NUOPC_FreeFormatCreate(config, label="DRIVER_info_attributes::", relaxedflag=.true., rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeIngest(child, attrFF, addFlag=.true., rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + + ! for now read DRIVER_maps_attributes from config file into FreeFormat + attrFF = NUOPC_FreeFormatCreate(config, label="DRIVER_maps_attributes::", relaxedflag=.true., rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeIngest(child, attrFF, addFlag=.true., rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_FreeFormatDestroy(attrFF, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + + ! for now read DRIVER_auxhist_attributes from config file into FreeFormat + attrFF = NUOPC_FreeFormatCreate(config, label="DRIVER_auxhist_attributes::", relaxedflag=.true., rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return call NUOPC_CompAttributeIngest(child, attrFF, addFlag=.true., rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return @@ -832,8 +803,8 @@ recursive subroutine ModifyCplLists(driver, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return ! go through all of the entries in the cplList and add options do j=1, cplListSize -! tempString = trim(cplList(j))//":REMAPMETHOD=bilinear"//& -! ":SrcTermProcessing=1:DUMPWEIGHTS=true:TermOrder=SrcSeq" + !tempString = trim(cplList(j))//":REMAPMETHOD=bilinear"//& + !":SrcTermProcessing=1:DUMPWEIGHTS=true:TermOrder=SrcSeq" tempString = trim(cplList(j))//":remapmethod=redist" cplList(j) = trim(tempString) enddo @@ -855,132 +826,52 @@ end subroutine ModifyCplLists !----------------------------------------------------------------------------- - subroutine esm_AddAttributes(gcomp, MCTID, rc) - ! Add specific set of attributes to gcomp from infodata + subroutine esm_AddAttributes(gcomp, driver, MCTID, rc) + + ! Add specific set of attributes to gcomp from driver attributes + use shr_sys_mod + + ! input/output parameters type(ESMF_GridComp),intent(inout) :: gcomp integer ,intent(in) :: MCTID + type(ESMF_GridComp),intent(in) :: driver integer ,intent(inout) :: rc ! locals - character(len=CL) :: cvalue - integer :: ivalue, n - real(r8) :: rvalue - logical :: lvalue - integer, parameter :: nattrlist = 21 - character(len=*), parameter, dimension(nattrlist) :: attrList = & - (/ "case_name ", "single_column ", "scmlat ", "scmlon ", & - "orb_eccen ", "orb_obliqr ", "orb_lambm0 ", "orb_mvelpp ", & - "read_restart ", "start_type ", "tfreeze_option", "model_version ", & - "info_debug ", "atm_aero ", & - "aqua_planet ", "brnch_rcase ", "perpetual ", "perpetual_ymd ", & - "hostname ", "username ", "MCTID " /) + character(len=CL) :: cvalue + integer :: n + integer, parameter :: nattrlist = 20 + character(len=*), parameter :: attrList(nattrlist) = & + (/ "case_name" ,"single_column","scmlat" ,"scmlon" , & + "read_restart" ,"start_type" ,"tfreeze_option","model_version" , & + "orb_eccen" ,"orb_obliqr" ,"orb_lambm0" ,"orb_mvelpp" , & + "info_debug" ,"atm_aero" ,"aqua_planet" ,"brnch_retain_casename", & + "perpetual" ,"perpetual_ymd","hostname" ,"username"/) character(len=*), parameter :: subname = "(esm.F90:esm_AddAttributes)" + !------------------------------------------- rc = ESMF_Success + ! First add MCTID to gcomp attributes + write(cvalue,*) MCTID + call NUOPC_CompAttributeAdd(gcomp, attrList=(/'MCTID'/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + call NUOPC_CompAttributeSet(gcomp, name='MCTID', value=trim(cvalue), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + ! Now add all the other attributes in AttrList (which have already been added to driver attributes) call NUOPC_CompAttributeAdd(gcomp, attrList=attrList, rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return do n = 1,nattrlist - - select case(trim(attrList(n))) - - case("case_name") - call seq_infodata_GetData(infodata, case_name=cvalue) - - case("single_column") - call seq_infodata_GetData(infodata, single_column=lvalue) - cvalue = "false" - if (lvalue) cvalue = "true" - - case ("scmlat") - call seq_infodata_GetData(infodata, scmlat=rvalue) - write(cvalue,'(g26.17)') rvalue - - case ("scmlon") - call seq_infodata_GetData(infodata, scmlon=rvalue) - write(cvalue,'(g26.17)') rvalue - - case("orb_eccen") - call seq_infodata_GetData(infodata, orb_eccen=rvalue) - write(cvalue,'(g26.17)') rvalue - - case("orb_obliqr") - call seq_infodata_GetData(infodata, orb_obliqr=rvalue) - write(cvalue,'(g26.17)') rvalue - - case("orb_lambm0") - call seq_infodata_GetData(infodata, orb_lambm0=rvalue) - write(cvalue,'(g26.17)') rvalue - - case("orb_mvelpp") - call seq_infodata_GetData(infodata, orb_mvelpp=rvalue) - write(cvalue,'(g26.17)') rvalue - - case("read_restart") - call seq_infodata_GetData(infodata, read_restart=lvalue) - cvalue = "false" - if (lvalue) cvalue = "true" - - case("start_type") - call seq_infodata_GetData(infodata, start_type=cvalue) - - case("tfreeze_option") - call seq_infodata_GetData(infodata, tfreeze_option=cvalue) - - case("model_version") - call seq_infodata_GetData(infodata, model_version=cvalue) - - case("info_debug") - call seq_infodata_GetData(infodata, info_debug=ivalue) - write(cvalue,'(i16)') ivalue - - case("atm_aero") - call seq_infodata_GetData(infodata, atm_aero=lvalue) - cvalue = "false" - if (lvalue) cvalue = "true" - - case("aqua_planet") - call seq_infodata_GetData(infodata, aqua_planet=lvalue) - cvalue = "false" - if (lvalue) cvalue = "true" - - case("brnch_rcase") - call seq_infodata_GetData(infodata, brnch_retain_casename=lvalue) - cvalue = "false" - if (lvalue) cvalue = "true" - - case("perpetual") - call seq_infodata_GetData(infodata, perpetual=lvalue) - cvalue = "false" - if (lvalue) cvalue = "true" - - case("perpetual_ymd") - call seq_infodata_GetData(infodata, perpetual_ymd=ivalue) - write(cvalue,'(i16)') ivalue - - case("hostname") - call seq_infodata_GetData(infodata, hostname=cvalue) - - case("username") - call seq_infodata_GetData(infodata, username=cvalue) - - case("MCTID") - write(cvalue,'(i16)') MCTID - - case default - rc = ESMF_Failure - call ESMF_LogWrite(trim(subname)//": unknown attrlist = "//trim(attrList(n)), ESMF_LOGMSG_INFO, rc=dbrc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - - end select - - call NUOPC_CompAttributeSet(gcomp, name=trim(attrList(n)), value=trim(cvalue), rc=rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - + call NUOPC_CompAttributeGet(driver, name=trim(attrList(n)), value=cvalue, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeSet(gcomp, name=trim(attrList(n)), value=trim(cvalue), rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return enddo end subroutine esm_AddAttributes !----------------------------------------------------------------------------- + end module ESM diff --git a/src/drivers/nuopc/main/esmApp.F90 b/src/drivers/nuopc/cime_driver/esmApp.F90 similarity index 100% rename from src/drivers/nuopc/main/esmApp.F90 rename to src/drivers/nuopc/cime_driver/esmApp.F90 diff --git a/src/drivers/nuopc/cime_driver/t_driver_timers_mod.F90 b/src/drivers/nuopc/cime_driver/t_driver_timers_mod.F90 new file mode 100644 index 00000000000..00b3ebdcba1 --- /dev/null +++ b/src/drivers/nuopc/cime_driver/t_driver_timers_mod.F90 @@ -0,0 +1,116 @@ +module t_drv_timers_mod + + use perf_mod + integer, private :: cpl_run_hash=0, cpl_comm_hash=0, cpl_budget_hash=0 + character(len=*),parameter :: strcpl = 'CPL:RUN' + character(len=*),parameter :: strcom = 'CPL:COMM' + character(len=*),parameter :: strbud = 'CPL:BUDGET' + +contains + + !=============================================================================== + + subroutine t_drvstartf(string,cplrun,cplcom,budget,barrier, hashint) + + implicit none + + character(len=*),intent(in) :: string + logical,intent(in),optional :: cplrun + logical,intent(in),optional :: cplcom + logical,intent(in),optional :: budget + integer,intent(in),optional :: barrier + integer,intent(inout), optional :: hashint + + character(len=128) :: strbar + + logical :: lcplrun,lcplcom,lbudget + !------------------------------------------------------------------------------- + + lcplrun = .false. + lcplcom = .false. + lbudget = .false. + if (present(cplrun)) then + lcplrun = cplrun + endif + if (present(cplcom)) then + lcplcom = cplcom + endif + if (present(budget)) then + lbudget = budget + endif + + if (present(barrier)) then + strbar = trim(string)//'_BARRIER' + call t_barrierf (trim(strbar), barrier) + endif + + if (lcplrun) then + call t_startf (trim(strcpl), cpl_run_hash) + call t_adj_detailf(+1) + endif + + if (lcplcom) then + call t_startf (trim(strcom), cpl_comm_hash) + call t_adj_detailf(+1) + endif + + if (lbudget) then + call t_startf (trim(strbud), cpl_budget_hash) + call t_adj_detailf(+1) + endif + + call t_startf (trim(string),hashint) + call t_adj_detailf(+1) + + end subroutine t_drvstartf + + !=============================================================================== + + subroutine t_drvstopf(string,cplrun,cplcom,budget,hashint) + + implicit none + + character(len=*),intent(in) :: string + logical,intent(in),optional :: cplrun + logical,intent(in),optional :: cplcom + logical,intent(in),optional :: budget + integer, intent(in), optional :: hashint + character(len=128) :: strbar + logical :: lcplrun,lcplcom,lbudget + + !------------------------------------------------------------------------------- + + lcplrun = .false. + lcplcom = .false. + lbudget = .false. + if (present(cplrun)) then + lcplrun = cplrun + endif + if (present(cplcom)) then + lcplcom = cplcom + endif + if (present(budget)) then + lbudget = budget + endif + + call t_adj_detailf(-1) + call t_stopf (trim(string), hashint) + + if (lbudget) then + call t_adj_detailf(-1) + call t_stopf (trim(strbud), cpl_budget_hash) + endif + + if (lcplrun) then + call t_adj_detailf(-1) + call t_stopf (trim(strcpl), cpl_run_hash) + endif + + if (lcplcom) then + call t_adj_detailf(-1) + call t_stopf (trim(strcom),cpl_comm_hash) + endif + + end subroutine t_drvstopf + +end module t_drv_timers_mod diff --git a/src/drivers/nuopc/main/ESMFConvenienceMacros.h b/src/drivers/nuopc/mediator/ESMFConvenienceMacros.h similarity index 100% rename from src/drivers/nuopc/main/ESMFConvenienceMacros.h rename to src/drivers/nuopc/mediator/ESMFConvenienceMacros.h diff --git a/src/drivers/nuopc/main/ESMFVersionDefine.h b/src/drivers/nuopc/mediator/ESMFVersionDefine.h similarity index 100% rename from src/drivers/nuopc/main/ESMFVersionDefine.h rename to src/drivers/nuopc/mediator/ESMFVersionDefine.h diff --git a/src/drivers/nuopc/main/med.F90 b/src/drivers/nuopc/mediator/med.F90 similarity index 89% rename from src/drivers/nuopc/main/med.F90 rename to src/drivers/nuopc/mediator/med.F90 index 69c433eb47d..5bbd08442cc 100644 --- a/src/drivers/nuopc/main/med.F90 +++ b/src/drivers/nuopc/mediator/med.F90 @@ -17,15 +17,77 @@ module MED mediator_label_TimestampExport => label_TimestampExport, & mediator_label_SetRunClock => label_SetRunClock, & NUOPC_MediatorGet - use shr_nuopc_fldList_mod - use shr_nuopc_methods_mod + + use shr_kind_mod , only: SHR_KIND_CL use seq_flds_mod - use seq_infodata_mod, only: infodata=>seq_infodata_infodata - use shr_mct_mod, only: shr_mct_queryConfigFile - use med_constants_mod - use med_internalstate_mod - use med_connectors_mod - use med_phases_mod + use seq_infodata_mod , only: infodata=>seq_infodata_infodata + + use shr_nuopc_fldList_mod , only: shr_nuopc_fldList_Zero + use shr_nuopc_fldList_mod , only: shr_nuopc_fldList_fromseqflds + use shr_nuopc_fldList_mod , only: shr_nuopc_fldList_Add + use shr_nuopc_fldList_mod , only: shr_nuopc_fldList_Realize + use shr_nuopc_fldList_mod , only: shr_nuopc_fldList_Advertise + use shr_nuopc_methods_mod , only: shr_nuopc_methods_RH_Init + use shr_nuopc_methods_mod , only: shr_nuopc_methods_FB_Init + use shr_nuopc_methods_mod , only: shr_nuopc_methods_FB_Reset + use shr_nuopc_methods_mod , only: shr_nuopc_methods_Field_GeomPrint + use shr_nuopc_methods_mod , only: shr_nuopc_methods_State_GeomPrint + use shr_nuopc_methods_mod , only: shr_nuopc_methods_State_GeomWrite + use shr_nuopc_methods_mod , only: shr_nuopc_methods_State_reset + use shr_nuopc_methods_mod , only: shr_nuopc_methods_CopyStateToInfodata + use shr_nuopc_methods_mod , only: shr_nuopc_methods_ChkErr + use shr_nuopc_methods_mod , only: shr_nuopc_methods_clock_timeprint + use med_internalstate_mod , only: InternalState + use med_internalstate_mod , only: fldsToAtm + use med_internalstate_mod , only: fldsFrAtm + use med_internalstate_mod , only: fldsToOcn + use med_internalstate_mod , only: fldsFrOcn + use med_internalstate_mod , only: fldsToIce + use med_internalstate_mod , only: fldsFrIce + use med_internalstate_mod , only: fldsToLnd + use med_internalstate_mod , only: fldsFrLnd + use med_internalstate_mod , only: fldsToRof + use med_internalstate_mod , only: fldsFrRof + use med_internalstate_mod , only: fldsToWav + use med_internalstate_mod , only: fldsFrWav + use med_internalstate_mod , only: fldsToGlc + use med_internalstate_mod , only: fldsFrGlc + use med_internalstate_mod , only: fldsAtmOcn + use med_internalstate_mod , only: medToAtm + use med_internalstate_mod , only: medToOcn + use med_internalstate_mod , only: medToIce + use med_internalstate_mod , only: medToLnd + use med_internalstate_mod , only: medToRof + use med_internalstate_mod , only: medToWav + use med_internalstate_mod , only: medToGlc + use med_connectors_mod , only: med_connectors_prep_med2atm + use med_connectors_mod , only: med_connectors_prep_med2ocn + use med_connectors_mod , only: med_connectors_prep_med2ice + use med_connectors_mod , only: med_connectors_prep_med2lnd + use med_connectors_mod , only: med_connectors_prep_med2rof + use med_connectors_mod , only: med_connectors_prep_med2wav + use med_connectors_mod , only: med_connectors_prep_med2glc + use med_connectors_mod , only: med_connectors_post_atm2med + use med_connectors_mod , only: med_connectors_post_ocn2med + use med_connectors_mod , only: med_connectors_post_ice2med + use med_connectors_mod , only: med_connectors_post_lnd2med + use med_connectors_mod , only: med_connectors_post_rof2med + use med_connectors_mod , only: med_connectors_post_wav2med + use med_connectors_mod , only: med_connectors_post_glc2med + use med_phases_mod , only: med_phases_prep_atm + use med_phases_mod , only: med_phases_prep_ocn + use med_phases_mod , only: med_phases_prep_ice + use med_phases_mod , only: med_phases_prep_lnd + use med_phases_mod , only: med_phases_prep_rof + use med_phases_mod , only: med_phases_prep_wav + use med_phases_mod , only: med_phases_prep_glc + use med_phases_mod , only: med_phases_accum_fast + use med_constants_mod , only: med_constants_dbug_flag + use med_constants_mod , only: med_constants_statewrite_flag + use med_constants_mod , only: med_constants_spval_init + use med_constants_mod , only: med_constants_spval + use med_constants_mod , only: med_constants_czero + use med_constants_mod , only: med_constants_ispval_mask implicit none @@ -57,7 +119,7 @@ subroutine SetServices(gcomp, rc) rc = ESMF_SUCCESS !------------------ - ! the NUOPC model component will register the generic methods + ! the NUOPC model component mediator_routine_SS will register the generic methods !------------------ call NUOPC_CompDerive(gcomp, mediator_routine_SS, rc=rc) @@ -76,6 +138,11 @@ subroutine SetServices(gcomp, rc) ! IPDv03p1: advertise Fields !------------------ + ! Mediator advertises its import and export Fields and sets the TransferOfferGeomObject Attribute. + ! The TransferOfferGeomObject is a String value indicating a component’s + ! intention to transfer the underlying Grid or Mesh on which an advertised Field object is defined. + ! The valid values are: [will provide, can provide, cannot provide] + call NUOPC_CompSetEntryPoint(gcomp, ESMF_METHOD_INITIALIZE, & phaseLabelList=(/"IPDv03p1"/), userRoutine=InitializeIPDv03p1, rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return @@ -365,6 +432,10 @@ end subroutine InitializeP0 !----------------------------------------------------------------------- subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) + + ! Mediator advertises its import and export Fields and sets the + ! TransferOfferGeomObject Attribute. + type(ESMF_GridComp) :: gcomp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -380,7 +451,10 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) endif rc = ESMF_SUCCESS + !------------------ ! Allocate memory for the internal state and set it in the Component. + !------------------ + allocate(is_local%wrap, stat=stat) if (ESMF_LogFoundAllocError(statusToCheck=stat, & msg="Allocation of the internal state memory failed.", & @@ -391,9 +465,13 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! add a namespace + ! add a namespace (i.e. nested state) for each import and export component state in the mediator's InternalState !------------------ + ! Namespaces are implemented via nested states. This creates a nested state inside of + ! state. The nested state is returned as nestedState. nestedStateName will be used to name the + ! newly created nested state. + call NUOPC_AddNamespace(importState, namespace="ATM", nestedStateName="NestedState-AtmImp", nestedState=is_local%wrap%NState_AtmImp, rc=rc) call NUOPC_AddNamespace(importState, namespace="OCN", nestedStateName="NestedState-OcnImp", nestedState=is_local%wrap%NState_OcnImp, rc=rc) call NUOPC_AddNamespace(importState, namespace="ICE", nestedStateName="NestedState-IceImp", nestedState=is_local%wrap%NState_IceImp, rc=rc) @@ -409,6 +487,13 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) call NUOPC_AddNamespace(exportState, namespace="WAV", nestedStateName="NestedState-WavExp", nestedState=is_local%wrap%NState_WavExp, rc=rc) call NUOPC_AddNamespace(exportState, namespace="GLC", nestedStateName="NestedState-GlcExp", nestedState=is_local%wrap%NState_GlcExp, rc=rc) + !------------------ + ! Zero out list of field information in for shr_nuopc_fldList_Type entries in the InternalState + ! Note that this simply deallocates any existing allocated arrays in the shr_nuopc_fldslist_Type entries + ! below and then allocate character arrays in the shr_nuopc_fldList_Type but does not + ! actually set them to anything + !------------------ + call shr_nuopc_fldList_Zero(fldsFrAtm, rc=rc) call shr_nuopc_fldList_Zero(fldsToAtm, rc=rc) call shr_nuopc_fldList_Zero(fldsFrOcn, rc=rc) @@ -426,20 +511,19 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) call shr_nuopc_fldList_Zero(fldsAtmOcn, rc=rc) !------------------ - ! fldsToAtm + ! Create fldsToAtm !------------------ - call shr_nuopc_fldList_fromseqflds(fldsToAtm, seq_flds_x2a_states, "cannot provide", subname//":seq_flds_x2a_states", "bilinear", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return -! call shr_nuopc_fldList_fromseqflds(fldsToAtm, seq_flds_x2a_fluxes, "cannot provide", subname//":seq_flds_x2a_fluxes", "conservefrac", rc=rc) -! if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + ! call shr_nuopc_fldList_fromseqflds(fldsToAtm, seq_flds_x2a_fluxes, "cannot provide", subname//":seq_flds_x2a_fluxes", "conservefrac", rc=rc) + ! if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return call shr_nuopc_fldList_fromseqflds(fldsToAtm, seq_flds_x2a_fluxes, "cannot provide", subname//":seq_flds_x2a_fluxes", "bilinear", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return call shr_nuopc_fldList_Add(fldsToAtm, trim(seq_flds_scalar_name), "will provide", subname//":seq_flds_scalar_name", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsFrAtm + ! Create fldsFrAtm !------------------ call shr_nuopc_fldList_fromseqflds(fldsFrAtm, seq_flds_a2x_states, "cannot provide", subname//":seq_flds_a2x_states", "bilinear", rc=rc) @@ -452,7 +536,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsToOcn + ! Create fldsToOcn !------------------ call shr_nuopc_fldList_fromseqflds(fldsToOcn, seq_flds_x2o_states, "cannot provide", subname//":seq_flds_x2o_states", "bilinear", rc=rc) @@ -465,7 +549,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsFrOcn + ! Create fldsFrOcn !------------------ call shr_nuopc_fldList_fromseqflds(fldsFrOcn, seq_flds_o2x_states, "cannot provide", subname//":seq_flds_o2x_states", "bilinear", rc=rc) @@ -478,7 +562,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsToIce + ! Create fldsToIce !------------------ call shr_nuopc_fldList_fromseqflds(fldsToIce, seq_flds_x2i_states, "cannot provide", subname//":seq_flds_x2i_states", "bilinear", rc=rc) @@ -491,7 +575,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsFrIce + ! Create fldsFrIce !------------------ call shr_nuopc_fldList_fromseqflds(fldsFrIce, seq_flds_i2x_states, "cannot provide", subname//":seq_flds_i2x_states", "bilinear", rc=rc) @@ -504,7 +588,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsToLnd + ! Create fldsToLnd !------------------ call shr_nuopc_fldList_fromseqflds(fldsToLnd, seq_flds_x2l_states, "cannot provide", subname//":seq_flds_x2l_states", "bilinear", rc=rc) @@ -517,7 +601,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsFrLnd + ! Create fldsFrLnd !------------------ call shr_nuopc_fldList_fromseqflds(fldsFrLnd, seq_flds_l2x_states, "cannot provide", subname//":seq_flds_l2x_states", "bilinear", rc=rc) @@ -530,7 +614,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsToRof + ! Create fldsToRof !------------------ call shr_nuopc_fldList_fromseqflds(fldsToRof, seq_flds_x2r_states, "cannot provide", subname//":seq_flds_x2r_states", "bilinear", rc=rc) @@ -543,7 +627,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsFrRof + ! Create fldsFrRof !------------------ call shr_nuopc_fldList_fromseqflds(fldsFrRof, seq_flds_r2x_states, "cannot provide", subname//":seq_flds_r2x_states", "bilinear", rc=rc) @@ -556,7 +640,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsToWav + ! Create fldsToWav !------------------ call shr_nuopc_fldList_fromseqflds(fldsToWav, seq_flds_x2r_states, "cannot provide", subname//":seq_flds_x2r_states", "bilinear", rc=rc) @@ -569,7 +653,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsFrWav + ! Create fldsFrWav !------------------ call shr_nuopc_fldList_fromseqflds(fldsFrWav, seq_flds_r2x_states, "cannot provide", subname//":seq_flds_r2x_states", "bilinear", rc=rc) @@ -582,7 +666,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsToGlc + ! Create fldsToGlc !------------------ call shr_nuopc_fldList_fromseqflds(fldsToGlc, seq_flds_x2r_states, "cannot provide", subname//":seq_flds_x2r_states", "bilinear", rc=rc) @@ -595,7 +679,7 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! fldsFrGlc + ! Create fldsFrGlc !------------------ call shr_nuopc_fldList_fromseqflds(fldsFrGlc, seq_flds_r2x_states, "cannot provide", subname//":seq_flds_r2x_states", "bilinear", rc=rc) @@ -608,9 +692,11 @@ subroutine InitializeIPDv03p1(gcomp, importState, exportState, clock, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return !------------------ - ! Advertise + ! Mediator advertisement !------------------ + ! Call NUOPC_Advertise from the mediator for each entry in the flds[Fr,To]XXX + call shr_nuopc_fldList_Advertise(is_local%wrap%NState_AtmImp, fldsFrAtm, subname//':FrAtm', rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return call shr_nuopc_fldList_Advertise(is_local%wrap%NState_LndImp, fldsFrLnd, subname//':FrLnd', rc) @@ -650,23 +736,29 @@ end subroutine InitializeIPDv03p1 !----------------------------------------------------------------------------- subroutine InitializeIPDv03p3(gcomp, importState, exportState, clock, rc) + + ! Realize connected Fields with transfer action "provide" + type(ESMF_GridComp) :: gcomp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock integer, intent(out) :: rc ! local variables - integer :: i, j + integer :: i, j real(kind=ESMF_KIND_R8),pointer :: lonPtr(:), latPtr(:) - type(ESMF_VM) :: vm - type(InternalState) :: is_local - integer :: lmpicom - real(ESMF_KIND_R8) :: intervalSec - type(ESMF_TimeInterval) :: timeStep + type(ESMF_VM) :: vm + type(InternalState) :: is_local + integer :: lmpicom + real(ESMF_KIND_R8) :: intervalSec + type(ESMF_TimeInterval) :: timeStep ! tcx XGrid -! type(ESMF_Field) :: fieldX, fieldA, fieldO -! type(ESMF_XGrid) :: xgrid - character(len=*),parameter :: subname='(module_MEDIATOR:InitializeIPDv03p3)' +! type(ESMF_Field) :: fieldX, fieldA, fieldO +! type(ESMF_XGrid) :: xgrid + integer :: n + character(SHR_KIND_CL) :: cvalue + logical :: connected + character(len=*),parameter :: subname='(module_MEDIATOR:InitializeIPDv03p3)' if (dbug_flag > 5) then call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO, rc=dbrc) @@ -693,7 +785,61 @@ subroutine InitializeIPDv03p3(gcomp, importState, exportState, clock, rc) is_local%wrap%wavcntr = 0 is_local%wrap%glccntr = 0 + is_local%wrap%atmcntr_post = 0 + is_local%wrap%ocncntr_post = 0 + is_local%wrap%icecntr_post = 0 + is_local%wrap%lndcntr_post = 0 + is_local%wrap%rofcntr_post = 0 + is_local%wrap%wavcntr_post = 0 + is_local%wrap%glccntr_post = 0 + ! tcraig hardwire 1 degree grid as backup option + ! Determine if mediator will send to each component + medToAtm = .false. + do n = 1,fldsToAtm%num + connected = NUOPC_IsConnected(is_local%wrap%NState_AtmExp, fieldName=fldsToAtm%shortname(n)) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + if (connected) medToAtm = .true. + end do + write(cvalue,*) medToAtm + call ESMF_LogWrite(trim(subname)//": medToAtm is "//cvalue, ESMF_LOGMSG_INFO, rc=dbrc) + + medToOcn = .false. + do n = 1,fldsToOcn%num + connected = NUOPC_IsConnected(is_local%wrap%NState_OcnExp, fieldName=fldsToOcn%shortname(n)) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + if (connected) medToOcn = .true. + end do + write(cvalue,*) medToOcn + call ESMF_LogWrite(trim(subname)//": medToOcn is " // cvalue, ESMF_LOGMSG_INFO, rc=dbrc) + + medToIce = .false. + do n = 1,fldsToIce%num + connected = NUOPC_IsConnected(is_local%wrap%NState_IceExp, fieldName=fldsToIce%shortname(n)) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + if (connected) medToIce = .true. + end do + write(cvalue,*) medToIce + call ESMF_LogWrite(trim(subname)//": medToIce is " // cvalue, ESMF_LOGMSG_INFO, rc=dbrc) + + medToLnd = .false. + do n = 1,fldsToLnd%num + connected = NUOPC_IsConnected(is_local%wrap%NState_LndExp, fieldName=fldsToLnd%shortname(n)) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + if (connected) medToLnd = .true. + end do + write(cvalue,*) medToLnd + call ESMF_LogWrite(trim(subname)//": medToLnd is " // cvalue, ESMF_LOGMSG_INFO, rc=dbrc) + + medToRof = .false. + do n = 1,fldsToRof%num + connected = NUOPC_IsConnected(is_local%wrap%NState_RofExp, fieldName=fldsToRof%shortname(n)) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + if (connected) medToRof = .true. + end do + write(cvalue,*) medToRof + call ESMF_LogWrite(trim(subname)//": medToRof is " // cvalue, ESMF_LOGMSG_INFO, rc=dbrc) + ! gridMed = ESMF_GridCreate1PeriDimUfrm(maxIndex=(/360,180/), & ! minCornerCoord=(/0._ESMF_KIND_R8, -90._ESMF_KIND_R8/), & ! maxCornerCoord=(/360._ESMF_KIND_R8, 90._ESMF_KIND_R8/), & @@ -768,6 +914,9 @@ end subroutine InitializeIPDv03p3 !----------------------------------------------------------------------------- subroutine InitializeIPDv03p4(gcomp, importState, exportState, clock, rc) + + ! Otionally modify the decomp/distr of transferred Grid/Mesh + type(ESMF_GridComp) :: gcomp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -794,11 +943,12 @@ subroutine InitializeIPDv03p4(gcomp, importState, exportState, clock, rc) rc = ESMF_SUCCESS - ! Get the internal state from Component. + ! Get the internal state from the mediator gridded component. nullify(is_local%wrap) call ESMF_GridCompGetInternalState(gcomp, is_local, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call realizeConnectedGrid(is_local%wrap%NState_atmImp, 'AtmImp', rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return @@ -1619,10 +1769,12 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) endif if (is_local%wrap%a2o_active) then - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'atm2ocn_fmapname:',fmapfile) - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'atm2ocn_smapname:',smapfile) - call ESMF_LogWrite(" fmapname "//trim(fmapfile), ESMF_LOGMSG_INFO) - call ESMF_LogWrite(" smapname "//trim(smapfile), ESMF_LOGMSG_INFO) + call NUOPC_CompAttributeGet(gcomp, name="atm2ocn_fmapname", value=fmapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeGet(gcomp, name="atm2ocn_smapname", value=smapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(" fmapname a2o "//trim(fmapfile), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(" smapname a2o "//trim(smapfile), ESMF_LOGMSG_INFO) call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBAtm_a, FBdst=is_local%wrap%FBAtm_o, & bilnrmap=is_local%wrap%RH_a2o_bilnr, & consfmap=is_local%wrap%RH_a2o_consf, & @@ -1638,8 +1790,12 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) endif if (is_local%wrap%a2i_active) then - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'atm2ice_fmapname:',fmapfile) - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'atm2ice_smapname:',smapfile) + call NUOPC_CompAttributeGet(gcomp, name="atm2ice_fmapname", value=fmapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeGet(gcomp, name="atm2ice_smapname", value=smapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(" fmapname a2i "//trim(fmapfile), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(" smapname a2i "//trim(smapfile), ESMF_LOGMSG_INFO) call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBAtm_a, FBdst=is_local%wrap%FBAtm_i, & bilnrmap=is_local%wrap%RH_a2i_bilnr, & consfmap=is_local%wrap%RH_a2i_consf, & @@ -1655,8 +1811,12 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) endif if (is_local%wrap%a2l_active) then - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'atm2lnd_fmapname:',fmapfile) - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'atm2lnd_smapname:',smapfile) + call NUOPC_CompAttributeGet(gcomp, name="atm2lnd_fmapname", value=fmapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeGet(gcomp, name="atm2lnd_smapname", value=smapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(" fmapname a2l "//trim(fmapfile), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(" smapname a2l "//trim(smapfile), ESMF_LOGMSG_INFO) call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBAtm_a, FBdst=is_local%wrap%FBAtm_l, & bilnrmap=is_local%wrap%RH_a2l_bilnr, & consfmap=is_local%wrap%RH_a2l_consf, & @@ -1671,8 +1831,12 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) endif if (is_local%wrap%o2a_active) then - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'ocn2atm_fmapname:',fmapfile) - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'ocn2atm_smapname:',smapfile) + call NUOPC_CompAttributeGet(gcomp, name="ocn2atm_fmapname", value=fmapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeGet(gcomp, name="ocn2atm_smapname", value=smapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(" fmapname o2a "//trim(fmapfile), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(" smapname o2a "//trim(smapfile), ESMF_LOGMSG_INFO) call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBOcn_o, FBdst=is_local%wrap%FBOcn_a, & bilnrmap=is_local%wrap%RH_o2a_bilnr, & consfmap=is_local%wrap%RH_o2a_consf, & @@ -1688,8 +1852,6 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) endif if (is_local%wrap%o2i_active) then -! call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'ocn2ice_fmapname:',fmapfile) -! call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'ocn2ice_smapname:',smapfile) fmapfile = "idmap" smapfile = "idmap" call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBOcn_o, FBdst=is_local%wrap%FBOcn_i, & @@ -1707,8 +1869,12 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) endif if (is_local%wrap%i2a_active) then - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'ice2atm_fmapname:',fmapfile) - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'ice2atm_smapname:',smapfile) + call NUOPC_CompAttributeGet(gcomp, name="ice2atm_fmapname", value=fmapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeGet(gcomp, name="ice2atm_smapname", value=smapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(" fmapname i2a "//trim(fmapfile), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(" smapname i2a "//trim(smapfile), ESMF_LOGMSG_INFO) call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBIce_i, FBdst=is_local%wrap%FBIce_a, & bilnrmap=is_local%wrap%RH_i2a_bilnr, & consfmap=is_local%wrap%RH_i2a_consf, & @@ -1724,8 +1890,6 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) endif if (is_local%wrap%i2o_active) then -! call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'ice2ocn_fmapname:',fmapfile) -! call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'ice2ocn_smapname:',smapfile) fmapfile = "idmap" smapfile = "idmap" call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBIce_i, FBdst=is_local%wrap%FBIce_o, & @@ -1743,8 +1907,12 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) endif if (is_local%wrap%l2a_active) then - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'lnd2atm_fmapname:',fmapfile) - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'lnd2atm_smapname:',smapfile) + call NUOPC_CompAttributeGet(gcomp, name="lnd2atm_fmapname", value=fmapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_CompAttributeGet(gcomp, name="lnd2atm_smapname", value=smapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(" fmapname l2a "//trim(fmapfile), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(" smapname l2a "//trim(smapfile), ESMF_LOGMSG_INFO) call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBLnd_l, FBdst=is_local%wrap%FBLnd_a, & bilnrmap=is_local%wrap%RH_l2a_bilnr, & consfmap=is_local%wrap%RH_l2a_consf, & @@ -1761,8 +1929,12 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) if (is_local%wrap%l2r_active) then ! tcx note bilinear is set to conserv to get past initialization. the subroutine thinks it'll ! need bilinear mapping weights but it won't for l2r. - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'lnd2rof_fmapname:',fmapfile) -! call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'lnd2rof_smapname:',smapfile) + call NUOPC_CompAttributeGet(gcomp, name="lnd2rof_fmapname", value=fmapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(" fmapname l2r "//trim(fmapfile), ESMF_LOGMSG_INFO) + !call NUOPC_CompAttributeGet(gcomp, name="lnd2rof_smapname", value=smapfile, rc=rc) + !if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + !call ESMF_LogWrite(" smapname l2a "//trim(smapfile), ESMF_LOGMSG_INFO) call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBLnd_l, FBdst=is_local%wrap%FBLnd_r, & bilnrmap=is_local%wrap%RH_l2r_bilnr, & consfmap=is_local%wrap%RH_l2r_consf, & @@ -1777,7 +1949,9 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) endif if (is_local%wrap%r2o_active) then - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'rof2ocn_liq_rmapname:',rlmapfile) + call NUOPC_CompAttributeGet(gcomp, name="rof2ocn_liq_rmapname", value=rlmapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(" rlmapname r2o"//trim(rlmapfile), ESMF_LOGMSG_INFO) call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBRof_r, FBdst=is_local%wrap%FBRof_o, & ! bilnrmap=is_local%wrap%RH_r2o_bilnr, & consfmap=is_local%wrap%RH_r2ol_consf, & @@ -1790,7 +1964,9 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'rof2ocn_ice_rmapname:',rimapfile) + call NUOPC_CompAttributeGet(gcomp, name="rof2ocn_ice_rmapname", value=rimapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(" rimapname r2o"//trim(rlmapfile), ESMF_LOGMSG_INFO) call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBRof_r, FBdst=is_local%wrap%FBRof_o, & ! bilnrmap=is_local%wrap%RH_r2o_bilnr, & consfmap=is_local%wrap%RH_r2oi_consf, & @@ -1806,8 +1982,9 @@ subroutine InitializeIPDv03p5(gcomp, importState, exportState, clock, rc) if (is_local%wrap%r2l_active) then ! tcx note bilinear is set to conserv to get past initialization. the subroutine thinks it'll ! need bilinear mapping weights but it won't for l2r. - call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'rof2lnd_fmapname:',fmapfile) -! call shr_mct_queryConfigFile(is_local%wrap%mpicom,maprcfile,'rof2lnd_smapname:',smapfile) + call NUOPC_CompAttributeGet(gcomp, name="rof2lnd_fmapname", value=fmapfile, rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(" fmapname r2l "//trim(fmapfile), ESMF_LOGMSG_INFO) call shr_nuopc_methods_RH_Init(FBsrc=is_local%wrap%FBRof_r, FBdst=is_local%wrap%FBRof_l, & bilnrmap=is_local%wrap%RH_r2l_bilnr, & consfmap=is_local%wrap%RH_r2l_consf, & @@ -1893,8 +2070,8 @@ subroutine DataInitialize(gcomp, rc) type(ESMF_StateItem_Flag) :: itemType logical :: atCorrectTime, allDone, connected type(InternalState) :: is_local - character(len=*), parameter :: subname='(module_MEDIATOR:DataInitialize)' integer :: n + character(len=*), parameter :: subname='(module_MEDIATOR:DataInitialize)' if (dbug_flag > 5) then call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO, rc=dbrc) diff --git a/src/drivers/nuopc/main/med_connectors_mod.F90 b/src/drivers/nuopc/mediator/med_connectors_mod.F90 similarity index 77% rename from src/drivers/nuopc/main/med_connectors_mod.F90 rename to src/drivers/nuopc/mediator/med_connectors_mod.F90 index 635a4f77e2b..f4707b1693f 100644 --- a/src/drivers/nuopc/main/med_connectors_mod.F90 +++ b/src/drivers/nuopc/mediator/med_connectors_mod.F90 @@ -8,14 +8,31 @@ module med_connectors_mod use ESMF use NUOPC + use shr_kind_mod, only: SHR_KIND_CL use shr_nuopc_methods_mod, only: shr_nuopc_methods_ChkErr use shr_nuopc_methods_mod, only: shr_nuopc_methods_CopyStateToInfodata use shr_nuopc_methods_mod, only: shr_nuopc_methods_CopyInfodataToState use shr_nuopc_methods_mod, only: shr_nuopc_methods_State_diagnose use med_internalstate_mod + ! use med_internal_state_mode, only : fldsToAtm + ! use med_internal_state_mode, only : fldsFrAtm + ! use med_internal_state_mode, only : fldsToOcn + ! use med_internal_state_mode, only : fldsFrOcn + ! use med_internal_state_mode, only : fldsToIce + ! use med_internal_state_mode, only : fldsFrIce + ! use med_internal_state_mode, only : fldsToLnd + ! use med_internal_state_mode, only : fldsFrLnd + ! use med_internal_state_mode, only : fldsToRof + ! use med_internal_state_mode, only : fldsFrRof + ! use med_internal_state_mode, only : fldsToWav + ! use med_internal_state_mode, only : fldsFrWav + ! use med_internal_state_mode, only : fldsToGlc + ! use med_internal_state_mode, only : fldsFrGlc use med_constants_mod use seq_infodata_mod, only: infodata=>seq_infodata_infodata + ! DEBUG + use shr_sys_mod implicit none private @@ -26,9 +43,9 @@ module med_connectors_mod character(*),parameter :: u_FILE_u = & __FILE__ -!-------------------------------------------------------------------------- -! Public interfaces -!-------------------------------------------------------------------------- + !-------------------------------------------------------------------------- + ! Public interfaces + !-------------------------------------------------------------------------- public med_connectors_prep_med2atm public med_connectors_prep_med2ocn @@ -45,26 +62,29 @@ module med_connectors_mod public med_connectors_post_wav2med public med_connectors_post_glc2med -!-------------------------------------------------------------------------- -! Private -!-------------------------------------------------------------------------- + !-------------------------------------------------------------------------- + ! Private + !-------------------------------------------------------------------------- private med_connectors_prep_generic private med_connectors_post_generic private med_connectors_diagnose - !----------------------------------------------------------------------------- - contains - !----------------------------------------------------------------------------- +!----------------------------------------------------------------------------- +contains +!----------------------------------------------------------------------------- subroutine med_connectors_prep_generic(gcomp, type, rc) type(ESMF_GridComp) :: gcomp character(len=*), intent(in) :: type integer, intent(out) :: rc - + ! local variables - type(ESMF_Clock) :: clock - type(InternalState) :: is_local + type(ESMF_Clock) :: clock + type(InternalState) :: is_local + logical :: diagnose + logical :: connected + integer :: n character(len=*),parameter :: subname='(med_connectors_prep_generic)' if (dbug_flag > 5) then @@ -81,6 +101,7 @@ subroutine med_connectors_prep_generic(gcomp, type, rc) call ESMF_GridCompGetInternalState(gcomp, is_local, rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + !------------------------- ! diagnose export state ! update scalar data in Exp and Imp State @@ -89,45 +110,50 @@ subroutine med_connectors_prep_generic(gcomp, type, rc) select case (type) case('atm') - call med_connectors_diagnose(is_local%wrap%NState_AtmExp, is_local%wrap%atmcntr, "med_to_atm", rc=rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_AtmExp,'cpl2atm',is_local%wrap%mpicom,rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_AtmImp,'cpl2atm',is_local%wrap%mpicom,rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - + if (medToAtm) then + call med_connectors_diagnose(is_local%wrap%NState_AtmExp, is_local%wrap%atmcntr, "med_to_atm", rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_AtmExp,'cpl2atm',is_local%wrap%mpicom,rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_AtmImp,'cpl2atm',is_local%wrap%mpicom,rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + end if case('ocn') - call med_connectors_diagnose(is_local%wrap%NState_OcnExp, is_local%wrap%ocncntr, "med_to_ocn", rc=rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_OcnExp,'cpl2ocn',is_local%wrap%mpicom,rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_OcnImp,'cpl2ocn',is_local%wrap%mpicom,rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - + if (medToOcn) then + call med_connectors_diagnose(is_local%wrap%NState_OcnExp, is_local%wrap%ocncntr, "med_to_ocn", rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_OcnExp,'cpl2ocn',is_local%wrap%mpicom,rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_OcnImp,'cpl2ocn',is_local%wrap%mpicom,rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + end if case('ice') - call med_connectors_diagnose(is_local%wrap%NState_IceExp, is_local%wrap%icecntr, "med_to_ice", rc=rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_IceExp,'cpl2ice',is_local%wrap%mpicom,rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_IceImp,'cpl2ice',is_local%wrap%mpicom,rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - + if (medToIce) then + call med_connectors_diagnose(is_local%wrap%NState_IceExp, is_local%wrap%icecntr, "med_to_ice", rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_IceExp,'cpl2ice',is_local%wrap%mpicom,rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_IceImp,'cpl2ice',is_local%wrap%mpicom,rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + end if case('lnd') - call med_connectors_diagnose(is_local%wrap%NState_LndExp, is_local%wrap%lndcntr, "med_to_lnd", rc=rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_LndExp,'cpl2lnd',is_local%wrap%mpicom,rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_LndImp,'cpl2lnd',is_local%wrap%mpicom,rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - + if (medToLnd) then + call med_connectors_diagnose(is_local%wrap%NState_LndExp, is_local%wrap%lndcntr, "med_to_lnd", rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_LndExp,'cpl2lnd',is_local%wrap%mpicom,rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_LndImp,'cpl2lnd',is_local%wrap%mpicom,rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + end if case('rof') - call med_connectors_diagnose(is_local%wrap%NState_RofExp, is_local%wrap%rofcntr, "med_to_rof", rc=rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_RofExp,'cpl2rof',is_local%wrap%mpicom,rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_RofImp,'cpl2rof',is_local%wrap%mpicom,rc) - if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return - + if (medToRof) then + call med_connectors_diagnose(is_local%wrap%NState_RofExp, is_local%wrap%rofcntr, "med_to_rof", rc=rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_RofExp,'cpl2rof',is_local%wrap%mpicom,rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_nuopc_methods_CopyInfodataToState(infodata,is_local%wrap%NState_RofImp,'cpl2rof',is_local%wrap%mpicom,rc) + if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + end if case('default') rc = ESMF_Failure call ESMF_LogWrite(trim(subname)//trim(type)//" unsupported", ESMF_LOGMSG_INFO, rc=dbrc) @@ -146,11 +172,16 @@ subroutine med_connectors_post_generic(gcomp, type, rc) type(ESMF_GridComp) :: gcomp character(len=*), intent(in) :: type integer, intent(out) :: rc - + !DEBUG + character(SHR_KIND_CL) :: cvalue + ! local variables - type(ESMF_Clock) :: clock - type(InternalState) :: is_local + type(ESMF_Clock) :: clock + type(InternalState) :: is_local character(len=*),parameter :: subname='(med_connectors_post_generic)' + + ! Note: for information obtained by the mediator always write out the state + ! if statewrite_flag is .true. This behavior is obtained by setting cntr to 1. if (dbug_flag > 5) then call ESMF_LogWrite(trim(subname)//trim(type)//": called", ESMF_LOGMSG_INFO, rc=dbrc) @@ -174,31 +205,44 @@ subroutine med_connectors_post_generic(gcomp, type, rc) select case (type) case('atm') - call med_connectors_diagnose(is_local%wrap%NState_AtmImp, is_local%wrap%atmcntr, "med_from_atm", rc=rc) + !DEBUG + write(cvalue,*) is_local%wrap%atmcntr_post + call ESMF_LogWrite(trim(subname)//trim(type)//"atmcntr_post is "// cvalue, ESMF_LOGMSG_INFO, rc=dbrc) + ! + is_local%wrap%atmcntr_post = is_local%wrap%atmcntr_post + 1 + call med_connectors_diagnose(is_local%wrap%NState_AtmImp, is_local%wrap%atmcntr_post, "med_from_atm", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return call shr_nuopc_methods_CopyStateToInfodata(is_local%wrap%NState_AtmImp,infodata,'atm2cpl',is_local%wrap%mpicom,rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return case('ocn') - call med_connectors_diagnose(is_local%wrap%NState_OcnImp, is_local%wrap%ocncntr, "med_from_ocn", rc=rc) + is_local%wrap%ocncntr_post = is_local%wrap%ocncntr_post + 1 + call med_connectors_diagnose(is_local%wrap%NState_OcnImp, is_local%wrap%ocncntr_post, "med_from_ocn", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return call shr_nuopc_methods_CopyStateToInfodata(is_local%wrap%NState_OcnImp,infodata,'ocn2cpl',is_local%wrap%mpicom,rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return case('ice') - call med_connectors_diagnose(is_local%wrap%NState_IceImp, is_local%wrap%icecntr, "med_from_ice", rc=rc) + !DEBUG + write(cvalue,*) is_local%wrap%icecntr_post + call ESMF_LogWrite(trim(subname)//trim(type)//"icecntr_post is "// cvalue, ESMF_LOGMSG_INFO, rc=dbrc) + ! + is_local%wrap%icecntr_post = is_local%wrap%icecntr_post + 1 + call med_connectors_diagnose(is_local%wrap%NState_IceImp, is_local%wrap%icecntr_post, "med_from_ice", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return call shr_nuopc_methods_CopyStateToInfodata(is_local%wrap%NState_IceImp,infodata,'ice2cpl',is_local%wrap%mpicom,rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return case('lnd') - call med_connectors_diagnose(is_local%wrap%NState_LndImp, is_local%wrap%lndcntr, "med_from_lnd", rc=rc) + is_local%wrap%lndcntr_post = is_local%wrap%lndcntr_post + 1 + call med_connectors_diagnose(is_local%wrap%NState_LndImp, is_local%wrap%lndcntr_post, "med_from_lnd", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return call shr_nuopc_methods_CopyStateToInfodata(is_local%wrap%NState_LndImp,infodata,'lnd2cpl',is_local%wrap%mpicom,rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return case('rof') - call med_connectors_diagnose(is_local%wrap%NState_RofImp, is_local%wrap%rofcntr, "med_from_rof", rc=rc) + is_local%wrap%rofcntr_post = is_local%wrap%rofcntr_post + 1 + call med_connectors_diagnose(is_local%wrap%NState_RofImp, is_local%wrap%rofcntr_post, "med_from_rof", rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return call shr_nuopc_methods_CopyStateToInfodata(is_local%wrap%NState_RofImp,infodata,'rof2cpl',is_local%wrap%mpicom,rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return @@ -600,6 +644,7 @@ subroutine med_connectors_diagnose(State, cntr, string, rc) call ESMF_StateGet(State, itemCount=fieldCount, rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return + ! Obtain the field names in State - allocate memory which will be deallocated at the end allocate(fieldnamelist(fieldCount)) call ESMF_StateGet(State, itemNameList=fieldnamelist, rc=rc) if (shr_nuopc_methods_ChkErr(rc,__LINE__,u_FILE_u)) return @@ -608,8 +653,9 @@ subroutine med_connectors_diagnose(State, cntr, string, rc) call shr_nuopc_methods_State_diagnose(State, trim(subname)//trim(string), rc=rc) endif + ! Write out the fields in State to netcdf files if (cntr > 0 .and. statewrite_flag) then - ! write the fields exported to atm to file + call ESMF_LogWrite(trim(subname)//trim(string)//": writing out fields", ESMF_LOGMSG_INFO, rc=dbrc) call NUOPC_Write(State, & fieldnamelist(1:fieldCount), & "field_"//trim(string)//"_", timeslice=cntr, & diff --git a/src/drivers/nuopc/main/med_constants_mod.F90 b/src/drivers/nuopc/mediator/med_constants_mod.F90 similarity index 92% rename from src/drivers/nuopc/main/med_constants_mod.F90 rename to src/drivers/nuopc/mediator/med_constants_mod.F90 index 1f67e3adab1..1372b874fcf 100644 --- a/src/drivers/nuopc/main/med_constants_mod.F90 +++ b/src/drivers/nuopc/mediator/med_constants_mod.F90 @@ -10,7 +10,7 @@ module med_constants_mod public - integer , parameter :: med_constants_dbug_flag = 5 + integer , parameter :: med_constants_dbug_flag = 6 logical , parameter :: med_constants_statewrite_flag = .true. real(ESMF_KIND_R8), parameter :: med_constants_spval_init = 0.0_ESMF_KIND_R8 ! spval for initialization real(ESMF_KIND_R8), parameter :: med_constants_spval = 0.0_ESMF_KIND_R8 ! spval diff --git a/src/drivers/nuopc/main/med_internalstate_mod.F90 b/src/drivers/nuopc/mediator/med_internalstate_mod.F90 similarity index 85% rename from src/drivers/nuopc/main/med_internalstate_mod.F90 rename to src/drivers/nuopc/mediator/med_internalstate_mod.F90 index f56d15ac221..f6a76965f1a 100644 --- a/src/drivers/nuopc/main/med_internalstate_mod.F90 +++ b/src/drivers/nuopc/mediator/med_internalstate_mod.F90 @@ -13,22 +13,30 @@ module med_internalstate_mod ! private internal state to keep instance data type InternalStateStruct - integer :: atmcntr - integer :: ocncntr - integer :: icecntr - integer :: lndcntr - integer :: rofcntr - integer :: wavcntr - integer :: glccntr - integer :: accumcntAtm ! accumulator counter - integer :: accumcntOcn ! accumulator counter - integer :: accumcntIce ! accumulator counter - integer :: accumcntLnd ! accumulator counter - integer :: accumcntRof ! accumulator counter - integer :: accumcntWav ! accumulator counter - integer :: accumcntGlc ! accumulator counter + integer :: atmcntr ! prep phase counter + integer :: ocncntr ! prep phase counter + integer :: icecntr ! prep phase counter + integer :: lndcntr ! prep phase counter + integer :: rofcntr ! prep phase counter + integer :: wavcntr ! prep phase counter + integer :: glccntr ! prep phase counter + integer :: accumcntAtm ! accumulator counter + integer :: accumcntOcn ! accumulator counter + integer :: accumcntIce ! accumulator counter + integer :: accumcntLnd ! accumulator counter + integer :: accumcntRof ! accumulator counter + integer :: accumcntWav ! accumulator counter + integer :: accumcntGlc ! accumulator counter integer :: accumcntAtmOcn ! accumulator counter + integer :: atmcntr_post ! post phase counter + integer :: ocncntr_post ! post phase counter + integer :: icecntr_post ! post phase counter + integer :: lndcntr_post ! post phase counter + integer :: rofcntr_post ! post phase counter + integer :: wavcntr_post ! post phase counter + integer :: glccntr_post ! post phase counter + type(ESMF_State) :: NState_AtmImp ! Atm Import nested state type(ESMF_State) :: NState_AtmExp ! Atm Export nested state type(ESMF_State) :: NState_OcnImp ! Ocn Import nested state @@ -181,6 +189,14 @@ module med_internalstate_mod type (shr_nuopc_fldList_Type) :: fldsFrGlc type (shr_nuopc_fldList_Type) :: fldsAtmOcn + ! The following flags determine if a component is prognostic + logical :: medToAtm + logical :: medToOcn + logical :: medToIce + logical :: medToLnd + logical :: medToRof + logical :: medToWav + logical :: medToGlc !----------------------------------------------------------------------------- end module med_internalstate_mod diff --git a/src/drivers/nuopc/main/med_phases_mod.F90 b/src/drivers/nuopc/mediator/med_phases_mod.F90 similarity index 100% rename from src/drivers/nuopc/main/med_phases_mod.F90 rename to src/drivers/nuopc/mediator/med_phases_mod.F90 diff --git a/src/drivers/nuopc/shr/seq_flds_mod.F90 b/src/drivers/nuopc/shr/seq_flds_mod.F90 new file mode 100644 index 00000000000..e4ede6155a9 --- /dev/null +++ b/src/drivers/nuopc/shr/seq_flds_mod.F90 @@ -0,0 +1,3689 @@ +module seq_flds_mod + + !==================================================================== + ! New standardized naming convention + !==================================================================== + ! + ! --------- + ! definitions: + ! --------- + ! state-prefix + ! first 3 characters: Sx_, Sa_, Si_, Sl_, So_ + ! one letter indices: x,a,l,i,o,g,r + ! x => coupler (mapping, merging, atm/ocn flux calc done on coupler procs) + ! a => atm + ! l => lnd + ! i => ice + ! o => ocn + ! g => glc + ! r => rof + ! w => wav + ! + ! state-name + ! what follows state prefix + ! + ! flux-prefix + ! first 5 characters: Flmn__ + ! lm => between components l and m + ! n => computed by component n + ! example: Fioi => ice/ocn flux computed by ice + ! example: Fall => atm/lnd flux computed by lnd + ! If flux prefix has first letter of P (so first five characters are PFlmn_) + ! then flux is passed straight through without scaling by the corresponding fraction) + ! + ! flux-name + ! what follows flux-prefix + ! + ! --------- + ! rules: + ! --------- + ! 1) states: + ! a) atm attributes fields that HAVE a state-prefix of Sx_ in seq_flds_x2a_states + ! rule: will merge all identical values of the state-names from + ! seq_flds_i2x_states + ! seq_flds_l2x_states + ! seq_flds_o2x_states + ! seq_flds_xao_states + ! to obtain output state-name in seq_flds_x2a_states + ! + ! rule: to merge input states that originate in the + ! lnd (l2x_a) will be scaled by the lndfrac + ! ice (i2x_a) will be scaled by the icefrac + ! cpl (xao_a) will be scaled by the ocnfrac + ! ocn (o2x_a) will be scaled by the ocnfrac + ! + ! example: + ! seq_flds_l2x_states = "Sl_t" + ! seq_flds_i2x_states = "Si_t" + ! seq_flds_o2x_states = "So_t" + ! seq_flds_x2a_states = "Sx_t" + ! attribute fields Sl_t, Si_t, So_t, in + ! attribute vectors l2x_a, i2x_a, o2x_a will be + ! merged to obtain attribute Sx_t in attribute vector x2a_a + ! + ! b) atm attribute fields that DO NOT HAVE a state-prefix of Sx_ in seq_flds_x2a_states + ! rule: copy directly all variables that identical state-prefix + ! AND state-name in + ! seq_flds_i2x_states and seq_flds_x2a_states + ! seq_flds_l2x_states and seq_flds_x2a_states + ! seq_flds_o2x_states and seq_flds_x2a_states + ! seq_flds_xao_states and seq_flds_x2a_states + ! + ! example + ! seq_flds_i2x_states = ":Si_snowh" + ! seq_flds_x2a_states = ":Si_snowh" + ! attribute field of Si_snowh in i2x_a will be copied to + ! attribute field Si_snowh in x2a_a + ! + ! 2) fluxes: + ! rule: will merge all identical values of the flux-names from + ! seq_flds_i2x_states + ! seq_flds_l2x_states + ! seq_flds_o2x_states + ! seq_flds_xao_states + ! to obtain output state-name in seq_flds_x2a_states + ! + ! rule: input flux fields that originate in the + ! lnd (l2x_a) will be scaled by the lndfrac + ! ice (i2x_a) will be scaled by the icefrac + ! - ignore all fluxes that are ice/ocn fluxes (e.g. Fioi_) + ! cpl (xao_a) will be scaled by the ocnfrac + ! ocn (o2x_a) will be scaled by the ocnfrac+icefrac + ! + !==================================================================== + ! + ! New user specified fields + ! + !==================================================================== + ! New fields that are user specidied can be added as namelist variables + ! by the user in the cpl namelist seq_flds_user using the namelist variable + ! array cplflds_customs. The user specified new fields must follow the + ! above naming convention. + ! As an example, say you want to add a new state 'foo' that is passed + ! from the land to the atm - you would do this as follows + ! &seq_flds_user + ! cplflds_custom = 'Sa_foo->a2x', 'Sa_foo->x2a' + ! / + ! This would add the field 'Sa_foo' to the character strings defining the + ! attribute vectors a2x and x2a. It is assumed that code would need to be + ! introduced in the atm and land components to deal with this new attribute + ! vector field. + ! Currently, the only way to add this is to edit $CASEROOT/user_nl_cpl + !==================================================================== + ! + ! Coupler fields use cases + ! + !==================================================================== + ! Previously, new fields that were needed to be passed between components + ! for certain compsets were specified by cpp-variables. This has been + ! modified to now be use cases. The use cases are specified in the + ! namelist cpl_flds_inparm and are currently triggered by the xml + ! variables CCSM_VOC, CCSM_BGC and GLC_NEC. + !==================================================================== + + use shr_kind_mod , only : CX => shr_kind_CX, CXX => shr_kind_CXX + use shr_sys_mod , only : shr_sys_abort + use seq_comm_mct , only : seq_comm_iamroot, seq_comm_setptrs, llogunit => logunit + use seq_drydep_mod , only : seq_drydep_init, seq_drydep_readnl, lnd_drydep + use shr_megan_mod , only : shr_megan_readnl, shr_megan_mechcomps_n + use shr_fire_emis_mod , only : shr_fire_emis_readnl, shr_fire_emis_mechcomps_n, shr_fire_emis_ztop_token + use shr_carma_mod , only : shr_carma_readnl + use shr_ndep_mod , only : shr_ndep_readnl + + implicit none + public + save + + interface seq_flds_lookup; module procedure & + seq_flds_esmf_metadata_get + end interface + + integer, parameter, private :: CSS = 256 ! use longer short character + integer, parameter, private :: CLL = 1024 + character(len=CXX) :: seq_drydep_fields ! List of dry-deposition fields + character(len=CXX) :: megan_voc_fields ! List of MEGAN VOC emission fields + character(len=CXX) :: fire_emis_fields ! List of fire emission fields + character(len=CX) :: carma_fields ! List of CARMA fields from lnd->atm + character(len=CX) :: ndep_fields ! List of nitrogen deposition fields from atm->lnd/ocn + integer :: ice_ncat ! number of sea ice thickness categories + logical :: seq_flds_i2o_per_cat! .true. if select per ice thickness category fields are passed from ice to ocean + logical :: add_ndep_fields ! .true. => add ndep fields + + !---------------------------------------------------------------------------- + ! metadata + !---------------------------------------------------------------------------- + + character(len=*),parameter :: undef = 'undefined' + integer ,parameter :: nmax = 1000 ! maximum number of entries in lookup_entry + integer :: n_entries = 0 ! actual number of entries in lookup_entry + character(len=CSS), dimension(nmax, 4) :: lookup_entry = undef + + !---------------------------------------------------------------------------- + ! for the scalars + !---------------------------------------------------------------------------- + + character(len=*) ,parameter :: seq_flds_scalar_name = "cpl_scalars" + integer ,parameter :: seq_flds_scalar_num = 10 + integer ,parameter :: seq_flds_scalar_index_present = 1, & + seq_flds_scalar_index_prognostic = 2, & + seq_flds_scalar_index_nx = 3, & + seq_flds_scalar_index_ny = 4, & + seq_flds_scalar_index_atm_aero = 5, & + seq_flds_scalar_index_precip_fact = 6, & + seq_flds_scalar_index_nextsw_cday = 7, & + seq_flds_scalar_index_g2lupdate = 8, & + seq_flds_scalar_index_dead_comps = 9, & + seq_flds_scalar_index_phase = 10 + + !---------------------------------------------------------------------------- + ! for the domain + !---------------------------------------------------------------------------- + + character(CXX) :: seq_flds_dom_coord + character(CXX) :: seq_flds_dom_other + + !---------------------------------------------------------------------------- + ! state + flux fields + !---------------------------------------------------------------------------- + + character(CXX) :: seq_flds_a2x_states + character(CXX) :: seq_flds_a2x_fluxes + character(CXX) :: seq_flds_x2a_states + character(CXX) :: seq_flds_x2a_fluxes + + character(CXX) :: seq_flds_i2x_states + character(CXX) :: seq_flds_i2x_fluxes + character(CXX) :: seq_flds_x2i_states + character(CXX) :: seq_flds_x2i_fluxes + + character(CXX) :: seq_flds_l2x_states + character(CXX) :: seq_flds_l2x_states_to_glc + character(CXX) :: seq_flds_l2x_fluxes + character(CXX) :: seq_flds_l2x_fluxes_to_glc + character(CXX) :: seq_flds_x2l_states + character(CXX) :: seq_flds_x2l_states_from_glc + character(CXX) :: seq_flds_x2l_fluxes + character(CXX) :: seq_flds_x2l_fluxes_from_glc + + character(CXX) :: seq_flds_o2x_states + character(CXX) :: seq_flds_o2x_fluxes + character(CXX) :: seq_flds_x2o_states + character(CXX) :: seq_flds_x2o_fluxes + + character(CXX) :: seq_flds_g2x_states + character(CXX) :: seq_flds_g2x_states_to_lnd + character(CXX) :: seq_flds_g2x_fluxes + character(CXX) :: seq_flds_g2x_fluxes_to_lnd + character(CXX) :: seq_flds_x2g_states + character(CXX) :: seq_flds_x2g_fluxes + + character(CXX) :: seq_flds_w2x_states + character(CXX) :: seq_flds_w2x_fluxes + character(CXX) :: seq_flds_x2w_states + character(CXX) :: seq_flds_x2w_fluxes + + character(CXX) :: seq_flds_xao_albedo + character(CXX) :: seq_flds_xao_states + character(CXX) :: seq_flds_xao_fluxes + character(CXX) :: seq_flds_xao_diurnl ! for diurnal cycle + + character(CXX) :: seq_flds_r2x_states + character(CXX) :: seq_flds_r2x_fluxes + character(CXX) :: seq_flds_x2r_states + character(CXX) :: seq_flds_x2r_fluxes + character(CXX) :: seq_flds_r2o_liq_fluxes + character(CXX) :: seq_flds_r2o_ice_fluxes + + !---------------------------------------------------------------------------- + ! combined state/flux fields + !---------------------------------------------------------------------------- + + character(CXX) :: seq_flds_dom_fields + character(CXX) :: seq_flds_a2x_fields + character(CXX) :: seq_flds_x2a_fields + character(CXX) :: seq_flds_i2x_fields + character(CXX) :: seq_flds_x2i_fields + character(CXX) :: seq_flds_l2x_fields + character(CXX) :: seq_flds_l2x_fields_to_glc + character(CXX) :: seq_flds_x2l_fields + character(CXX) :: seq_flds_x2l_fields_from_glc + character(CXX) :: seq_flds_o2x_fields + character(CXX) :: seq_flds_x2o_fields + character(CXX) :: seq_flds_xao_fields + character(CXX) :: seq_flds_r2x_fields + character(CXX) :: seq_flds_x2r_fields + character(CXX) :: seq_flds_g2x_fields + character(CXX) :: seq_flds_g2x_fields_to_lnd + character(CXX) :: seq_flds_x2g_fields + character(CXX) :: seq_flds_w2x_fields + character(CXX) :: seq_flds_x2w_fields + + !---------------------------------------------------------------------------- + ! component names + !---------------------------------------------------------------------------- + + character(32) :: atmname='atm' + character(32) :: ocnname='ocn' + character(32) :: icename='ice' + character(32) :: lndname='lnd' + character(32) :: glcname='glc' + character(32) :: wavname='wav' + character(32) :: rofname='rof' + +!---------------------------------------------------------------------------- + contains +!---------------------------------------------------------------------------- + + subroutine seq_flds_set(nmlfile, ID, cime_model) + + ! !USES: + use shr_file_mod, only : shr_file_getUnit, shr_file_freeUnit + use shr_string_mod, only : shr_string_listIntersect + use shr_mpi_mod, only : shr_mpi_bcast + use glc_elevclass_mod, only : glc_elevclass_init + + ! !INPUT/OUTPUT PARAMETERS: + character(len=*) , intent(in) :: nmlfile ! Name-list filename + integer , intent(in) :: ID ! seq_comm ID + character(len=*) , intent(in) :: cime_model ! acme or cesm + + ! !LOCAL VARIABLES: + integer :: mpicom ! MPI communicator + integer :: ierr ! I/O error code + integer :: unitn ! Namelist unit number to read + + character(len=CSS) :: attname + character(len=CSS) :: units + character(len=CSS) :: longname + character(len=CSS) :: stdname + integer :: num + character(len= 2) :: cnum + character(len=CSS) :: name + + character(CXX) :: dom_coord = '' + character(CXX) :: dom_other = '' + + character(CXX) :: a2x_states = '' + character(CXX) :: a2x_fluxes = '' + character(CXX) :: x2a_states = '' + character(CXX) :: x2a_fluxes = '' + character(CXX) :: i2x_states = '' + character(CXX) :: i2x_fluxes = '' + character(CXX) :: x2i_states = '' + character(CXX) :: x2i_fluxes = '' + character(CXX) :: l2x_states = '' + character(CXX) :: l2x_states_to_glc = '' + character(CXX) :: l2x_fluxes = '' + character(CXX) :: l2x_fluxes_to_glc = '' + character(CXX) :: x2l_states = '' + character(CXX) :: x2l_states_from_glc = '' + character(CXX) :: x2l_fluxes = '' + character(CXX) :: x2l_fluxes_from_glc = '' + character(CXX) :: o2x_states = '' + character(CXX) :: o2x_fluxes = '' + character(CXX) :: x2o_states = '' + character(CXX) :: x2o_fluxes = '' + character(CXX) :: g2x_states = '' + character(CXX) :: g2x_states_to_lnd = '' + character(CXX) :: g2x_fluxes = '' + character(CXX) :: g2x_fluxes_to_lnd = '' + character(CXX) :: x2g_states = '' + character(CXX) :: x2g_fluxes = '' + character(CXX) :: xao_albedo = '' + character(CXX) :: xao_states = '' + character(CXX) :: xao_fluxes = '' + character(CXX) :: xao_diurnl = '' + character(CXX) :: r2x_states = '' + character(CXX) :: r2x_fluxes = '' + character(CXX) :: x2r_states = '' + character(CXX) :: x2r_fluxes = '' + character(CXX) :: w2x_states = '' + character(CXX) :: w2x_fluxes = '' + character(CXX) :: x2w_states = '' + character(CXX) :: x2w_fluxes = '' + character(CXX) :: r2o_liq_fluxes = '' + character(CXX) :: r2o_ice_fluxes = '' + + character(CXX) :: stringtmp = '' + + !------ namelist ----- + character(len=CSS) :: fldname, fldflow + logical :: is_state, is_flux + integer :: i,n + + ! use cases namelists + logical :: flds_co2a + logical :: flds_co2b + logical :: flds_co2c + logical :: flds_co2_dmsa + logical :: flds_bgc + logical :: flds_wiso + integer :: glc_nec + + namelist /seq_cplflds_inparm/ & + flds_co2a, flds_co2b, flds_co2c, flds_co2_dmsa, flds_wiso, glc_nec, & + ice_ncat, seq_flds_i2o_per_cat, flds_bgc + + ! user specified new fields + integer, parameter :: nfldmax = 200 + character(len=CLL) :: cplflds_custom(nfldmax) = '' + + namelist /seq_cplflds_userspec/ & + cplflds_custom + + character(len=*),parameter :: subname = '(seq_flds_set) ' + !------------------------------------------------------------------------------- + + call seq_comm_setptrs(ID,mpicom=mpicom) + + !--------------------------------------------------------------------------- + ! Read in namelist for use cases + !--------------------------------------------------------------------------- + ! TODO: permit duplicates to occur - then check for this in seq_flds_add + ! TODO: add entries for lookup entry table for custom fields + !--------------------------------------------------------------------------- + + if (seq_comm_iamroot(ID)) then + flds_co2a = .false. + flds_co2b = .false. + flds_co2c = .false. + flds_co2_dmsa = .false. + flds_bgc = .false. + flds_wiso = .false. + glc_nec = 0 + ice_ncat = 1 + seq_flds_i2o_per_cat = .false. + + unitn = shr_file_getUnit() + write(llogunit,"(A)") subname//': read seq_cplflds_inparm namelist from: '& + //trim(nmlfile) + open( unitn, file=trim(nmlfile), status='old' ) + ierr = 1 + do while( ierr /= 0 ) + read(unitn,nml=seq_cplflds_inparm,iostat=ierr) + if (ierr < 0) then + call shr_sys_abort( & + subname//"ERROR: namelist read returns an EOF or EOR condition" ) + end if + end do + close(unitn) + call shr_file_freeUnit( unitn ) + end if + call shr_mpi_bcast(flds_co2a , mpicom) + call shr_mpi_bcast(flds_co2b , mpicom) + call shr_mpi_bcast(flds_co2c , mpicom) + call shr_mpi_bcast(flds_co2_dmsa, mpicom) + call shr_mpi_bcast(flds_bgc , mpicom) + call shr_mpi_bcast(flds_wiso , mpicom) + call shr_mpi_bcast(glc_nec , mpicom) + call shr_mpi_bcast(ice_ncat , mpicom) + call shr_mpi_bcast(seq_flds_i2o_per_cat, mpicom) + + call glc_elevclass_init(glc_nec) + + !--------------------------------------------------------------------------- + ! Read in namelists for user specified new fields + !--------------------------------------------------------------------------- + ! TODO: permit duplicates to occur - then check for this in seq_flds_add + ! TODO: add entries for lookup entry table for custom fields + !--------------------------------------------------------------------------- + + if (seq_comm_iamroot(ID)) then + cplflds_custom(:) = ' ' + + unitn = shr_file_getUnit() + write(llogunit,"(A)") subname//': read seq_cplflds_userspec namelist from: '& + //trim(nmlfile) + open( unitn, file=trim(nmlfile), status='old' ) + ierr = 1 + do while( ierr /= 0 ) + read(unitn,nml=seq_cplflds_userspec,iostat=ierr) + if (ierr < 0) then + call shr_sys_abort( & + subname//"ERROR: namelist read returns an EOF or EOR condition" ) + end if + end do + close(unitn) + call shr_file_freeUnit( unitn ) + end if + do n = 1, nfldmax + call shr_mpi_bcast(cplflds_custom(n), mpicom) + end do + + ! add customized fields through coupler + + do n = 1,nfldmax + if (cplflds_custom(n) /= ' ') then + i = scan(cplflds_custom(n),'->') + fldname = trim(adjustl(cplflds_custom(n)(:i-1))) + fldflow = trim(adjustl(cplflds_custom(n)(i+2:))) + + if (fldname(1:1) == 'S') then + is_state = .true. + is_flux = .false. + else if (fldname (1:1) == 'F') then + is_state = .false. + is_flux = .true. + else if (fldname (1:2) == 'PF') then + is_state = .false. + is_flux = .true. + else + write(llogunit,*) subname//'ERROR: fldname must start with S,F,P, not ',trim(fldname) + call shr_sys_abort(subname//"ERROR: fldname must start with S, F, or P") + end if + + select case (trim(fldflow)) + case('a2x') + if (is_state) call seq_flds_add(a2x_states,trim(fldname)) + if (is_flux ) call seq_flds_add(a2x_fluxes,trim(fldname)) + case('x2a') + if (is_state) call seq_flds_add(x2a_states,trim(fldname)) + if (is_flux ) call seq_flds_add(x2a_fluxes,trim(fldname)) + case('l2x') + if (is_state) call seq_flds_add(l2x_states,trim(fldname)) + if (is_flux ) call seq_flds_add(l2x_fluxes,trim(fldname)) + case('x2l') + if (is_state) call seq_flds_add(x2l_states,trim(fldname)) + if (is_flux ) call seq_flds_add(x2l_fluxes,trim(fldname)) + case('r2x') + if (is_state) call seq_flds_add(r2x_states,trim(fldname)) + if (is_flux ) call seq_flds_add(r2x_fluxes,trim(fldname)) + case('x2r') + if (is_state) call seq_flds_add(x2r_states,trim(fldname)) + if (is_flux ) call seq_flds_add(x2r_fluxes,trim(fldname)) + case('i2x') + if (is_state) call seq_flds_add(i2x_states,trim(fldname)) + if (is_flux ) call seq_flds_add(i2x_fluxes,trim(fldname)) + case('x2i') + if (is_state) call seq_flds_add(x2i_states,trim(fldname)) + if (is_flux ) call seq_flds_add(x2i_fluxes,trim(fldname)) + case('o2x') + if (is_state) call seq_flds_add(o2x_states,trim(fldname)) + if (is_flux ) call seq_flds_add(o2x_fluxes,trim(fldname)) + case('x2o') + if (is_state) call seq_flds_add(x2o_states,trim(fldname)) + if (is_flux ) call seq_flds_add(x2o_fluxes,trim(fldname)) + case('g2x') + if (is_state) call seq_flds_add(g2x_states,trim(fldname)) + if (is_flux ) call seq_flds_add(g2x_fluxes,trim(fldname)) + case('x2g') + if (is_state) call seq_flds_add(x2g_states,trim(fldname)) + if (is_flux ) call seq_flds_add(x2g_fluxes,trim(fldname)) + case default + write(llogunit,*) subname//'ERROR: ',trim(cplflds_custom(n)),& + ' not a recognized value' + call shr_sys_abort() + end select + else + exit + end if + end do + + !---------------------------------------------------------- + ! scalar information + !---------------------------------------------------------- + + longname = trim(seq_flds_scalar_name) + stdname = trim(seq_flds_scalar_name) + units = 'unitless' + attname = trim(seq_flds_scalar_name) + call metadata_set(attname, longname, stdname, units) + + !---------------------------------------------------------- + ! domain coordinates + !---------------------------------------------------------- + + call seq_flds_add(dom_coord,'lat') + longname = 'latitude' + stdname = 'latitude' + units = 'degrees north' + attname = 'lat' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(dom_coord,'lon') + longname = 'longitude' + stdname = 'longitude' + units = 'degrees east' + attname = 'lon' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(dom_coord,'hgt') + longname = 'height' + stdname = 'height, depth, or levels' + units = 'unitless' + attname = 'hgt' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(dom_other,'area') + longname = 'cell_area_model' + stdname = 'cell area from model' + units = 'radian^2' + attname = 'area' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(dom_other,'aream') + longname = 'cell_area_mapping' + stdname = 'cell area from mapping file' + units = 'radian^2' + attname = 'aream' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(dom_other,'mask') + longname = 'mask' + stdname = 'mask' + units = '1' + attname = 'mask' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(dom_other,'frac') + longname = 'area_fraction' + stdname = 'area fraction' + units = '1' + attname = 'frac' + call metadata_set(attname, longname, stdname, units) + + !---------------------------------------------------------- + ! states/fluxes from atm + !---------------------------------------------------------- + + ! height at the lowest model level (m) + call seq_flds_add(a2x_states,"Sa_z") + call seq_flds_add(x2l_states,"Sa_z") + call seq_flds_add(x2i_states,"Sa_z") + longname = 'Height at the lowest model level' + stdname = 'height' + units = 'm' + attname = 'Sa_z' + call metadata_set(attname, longname, stdname, units) + + ! topographic height (m) + call seq_flds_add(a2x_states,"Sa_topo") + call seq_flds_add(x2l_states,"Sa_topo") + longname = 'Surface height' + stdname = 'height' + units = 'm' + attname = 'Sa_topo' + call metadata_set(attname, longname, stdname, units) + + ! zonal wind at the lowest model level (m/s) + call seq_flds_add(a2x_states,"Sa_u") + call seq_flds_add(x2l_states,"Sa_u") + call seq_flds_add(x2i_states,"Sa_u") + call seq_flds_add(x2w_states,"Sa_u") + longname = 'Zonal wind at the lowest model level' + stdname = 'eastward_wind' + units = 'm s-1' + attname = 'Sa_u' + call metadata_set(attname, longname, stdname, units) + + ! meridional wind at the lowest model level (m/s) + call seq_flds_add(a2x_states,"Sa_v") + call seq_flds_add(x2l_states,"Sa_v") + call seq_flds_add(x2i_states,"Sa_v") + call seq_flds_add(x2w_states,"Sa_v") + longname = 'Meridional wind at the lowest model level' + stdname = 'northward_wind' + units = 'm s-1' + attname = 'Sa_v' + call metadata_set(attname, longname, stdname, units) + + ! temperature at the lowest model level (K) + call seq_flds_add(a2x_states,"Sa_tbot") + call seq_flds_add(x2l_states,"Sa_tbot") + call seq_flds_add(x2i_states,"Sa_tbot") + call seq_flds_add(x2w_states,"Sa_tbot") + longname = 'Temperature at the lowest model level' + stdname = 'air_temperature' + units = 'K' + attname = 'Sa_tbot' + call metadata_set(attname, longname, stdname, units) + + ! potential temperature at the lowest model level (K) + call seq_flds_add(a2x_states,"Sa_ptem") + call seq_flds_add(x2l_states,"Sa_ptem") + call seq_flds_add(x2i_states,"Sa_ptem") + longname = 'Potential temperature at the lowest model level' + stdname = 'air_potential_temperature' + units = 'K' + attname = 'Sa_ptem' + call metadata_set(attname, longname, stdname, units) + + ! specific humidity at the lowest model level (kg/kg) + call seq_flds_add(a2x_states,"Sa_shum") + call seq_flds_add(x2l_states,"Sa_shum") + call seq_flds_add(x2i_states,"Sa_shum") + longname = 'Specific humidity at the lowest model level' + stdname = 'specific_humidity' + units = 'kg kg-1' + attname = 'Sa_shum' + call metadata_set(attname, longname, stdname, units) + + ! pressure at the lowest model level (Pa) + call seq_flds_add(a2x_states,"Sa_pbot") + call seq_flds_add(x2l_states,"Sa_pbot") + call seq_flds_add(x2i_states,"Sa_pbot") + if (trim(cime_model) == 'acme') then + call seq_flds_add(x2o_states,"Sa_pbot") + end if + longname = 'Pressure at the lowest model level' + stdname = 'air_pressure' + units = 'Pa' + attname = 'Sa_pbot' + call metadata_set(attname, longname, stdname, units) + + ! air density at the lowest model level (kg/m**3) + call seq_flds_add(a2x_states,"Sa_dens") + call seq_flds_add(x2i_states,"Sa_dens") + longname = 'Density at the lowest model level' + stdname = 'air_density' + units = 'kg m-3' + attname = 'Sa_dens' + call metadata_set(attname, longname, stdname, units) + + ! convective precipitation rate + ! large-scale (stable) snow rate (water equivalent) + call seq_flds_add(a2x_fluxes,"Faxa_rainc") + call seq_flds_add(a2x_fluxes,"Faxa_rainl") + call seq_flds_add(x2l_fluxes,"Faxa_rainc") + call seq_flds_add(x2l_fluxes,"Faxa_rainl") + call seq_flds_add(x2i_fluxes,"Faxa_rain" ) + call seq_flds_add(x2o_fluxes,"Faxa_rain" ) + units = 'kg m-2 s-1' + longname = 'Convective precipitation rate' + stdname = 'convective_precipitation_flux' + attname = 'Faxa_rainc' + call metadata_set(attname, longname, stdname, units) + longname = 'Large-scale (stable) precipitation rate' + stdname = 'large_scale_precipitation_flux' + attname = 'Faxa_rainl' + call metadata_set(attname, longname, stdname, units) + longname = 'Water flux due to rain' + stdname = 'rainfall_flux' + attname = 'Faxa_rain' + call metadata_set(attname, longname, stdname, units) + + ! convective snow rate (water equivalent) + ! large-scale (stable) snow rate (water equivalent) + call seq_flds_add(a2x_fluxes,"Faxa_snowc") + call seq_flds_add(a2x_fluxes,"Faxa_snowl") + call seq_flds_add(x2l_fluxes,"Faxa_snowc") + call seq_flds_add(x2l_fluxes,"Faxa_snowl") + call seq_flds_add(x2i_fluxes,"Faxa_snow" ) + call seq_flds_add(x2o_fluxes,"Faxa_snow" ) + units = 'kg m-2 s-1' + longname = 'Convective snow rate (water equivalent)' + stdname = 'convective_snowfall_flux' + attname = 'Faxa_snowc' + call metadata_set(attname, longname, stdname, units) + longname = 'Large-scale (stable) snow rate (water equivalent)' + stdname = 'large_scale_snowfall_flux' + attname = 'Faxa_snowl' + call metadata_set(attname, longname, stdname, units) + longname = 'Water flux due to snow' + stdname = 'surface_snow_melt_flux' + attname = 'Faxa_snow' + call metadata_set(attname, longname, stdname, units) + + ! total precipitation to ocean + call seq_flds_add(x2o_fluxes,"Faxa_prec") ! derived rain+snow + longname = 'Water flux (rain+snow)' + stdname = 'precipitation_flux' + units = 'kg m-2 s-1' + attname = 'Faxa_prec' + call metadata_set(attname, longname, stdname, units) + + ! downward longwave heat flux (W/m**2) + call seq_flds_add(a2x_fluxes,"Faxa_lwdn") + call seq_flds_add(x2l_fluxes,"Faxa_lwdn") + call seq_flds_add(x2i_fluxes,"Faxa_lwdn") + call seq_flds_add(x2o_fluxes,"Faxa_lwdn") + longname = 'Downward longwave heat flux' + stdname = 'downwelling_longwave_flux' + units = 'W m-2' + attname = 'Faxa_lwdn' + call metadata_set(attname, longname, stdname, units) + + ! direct near-infrared incident solar radiation + call seq_flds_add(a2x_fluxes,"Faxa_swndr") + call seq_flds_add(x2i_fluxes,"Faxa_swndr") + call seq_flds_add(x2l_fluxes,"Faxa_swndr") + longname = 'Direct near-infrared incident solar radiation' + stdname = 'surface_downward_direct_shortwave_flux_due_to_near_infrared_radiation' + units = 'W m-2' + attname = 'Faxa_swndr' + call metadata_set(attname, longname, stdname, units) + + ! direct visible incident solar radiation + call seq_flds_add(a2x_fluxes,"Faxa_swvdr") + call seq_flds_add(x2i_fluxes,"Faxa_swvdr") + call seq_flds_add(x2l_fluxes,"Faxa_swvdr") + longname = 'Direct visible incident solar radiation' + stdname = 'surface_downward_direct_shortwave_flux_due_to_visible_radiation' + units = 'W m-2' + attname = 'Faxa_swvdr' + call metadata_set(attname, longname, stdname, units) + + ! diffuse near-infrared incident solar radiation + call seq_flds_add(a2x_fluxes,"Faxa_swndf") + call seq_flds_add(x2i_fluxes,"Faxa_swndf") + call seq_flds_add(x2l_fluxes,"Faxa_swndf") + longname = 'Diffuse near-infrared incident solar radiation' + stdname = 'surface_downward_diffuse_shortwave_flux_due_to_near_infrared_radiation' + units = 'W m-2' + attname = 'Faxa_swndf' + call metadata_set(attname, longname, stdname, units) + + ! diffuse visible incident solar radiation + call seq_flds_add(a2x_fluxes,"Faxa_swvdf") + call seq_flds_add(x2i_fluxes,"Faxa_swvdf") + call seq_flds_add(x2l_fluxes,"Faxa_swvdf") + longname = 'Diffuse visible incident solar radiation' + stdname = 'surface_downward_diffuse_shortwave_flux_due_to_visible_radiation' + units = 'W m-2' + attname = 'Faxa_swvdf' + call metadata_set(attname, longname, stdname, units) + + ! Net shortwave radiation + call seq_flds_add(a2x_fluxes,"Faxa_swnet") ! diagnostic + call seq_flds_add(l2x_fluxes,"Fall_swnet") ! diagnostic + call seq_flds_add(i2x_fluxes,"Faii_swnet") ! diagnostic + + call seq_flds_add(i2x_fluxes,"Fioi_swpen") ! used for Foxx_swnet below + call seq_flds_add(x2o_fluxes,"Foxx_swnet") ! derived using albedos, Faxa_swxxx and swpen + units = 'W m-2' + longname = 'Net shortwave radiation' + stdname = 'surface_net_shortwave_flux' + attname = 'Faxa_swnet' + call metadata_set(attname, longname, stdname, units) + attname = 'Fall_swnet' + call metadata_set(attname, longname, stdname, units) + attname = 'Faii_swnet' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_swnet' + call metadata_set(attname, longname, stdname, units) + longname = 'Net shortwave radiation penetrating into ice and ocean' + stdname = 'net_downward_shortwave_flux_in_sea_ice_due_to_penetration' + attname = 'Fioi_swpen' + call metadata_set(attname, longname, stdname, units) + + ! Black Carbon hydrophilic dry deposition + call seq_flds_add(a2x_fluxes,"Faxa_bcphidry" ) + call seq_flds_add(x2i_fluxes,"Faxa_bcphidry" ) + call seq_flds_add(x2l_fluxes,"Faxa_bcphidry" ) + call seq_flds_add(x2o_fluxes,"Faxa_bcphidry" ) + longname = 'Hydrophylic black carbon dry deposition flux' + stdname = 'dry_deposition_flux_of_hydrophylic_black_carbon' + units = 'kg m-2 s-1' + attname = 'Faxa_bcphidry' + call metadata_set(attname, longname, stdname, units) + + ! Black Carbon hydrophobic dry deposition + call seq_flds_add(a2x_fluxes,"Faxa_bcphodry" ) + call seq_flds_add(x2i_fluxes,"Faxa_bcphodry" ) + call seq_flds_add(x2l_fluxes,"Faxa_bcphodry" ) + call seq_flds_add(x2o_fluxes,"Faxa_bcphodry") + longname = 'Hydrophobic black carbon dry deposition flux' + stdname = 'dry_deposition_flux_of_hydrophobic_black_carbon' + units = 'kg m-2 s-1' + attname = 'Faxa_bcphodry' + call metadata_set(attname, longname, stdname, units) + + ! Black Carbon hydrophilic wet deposition + call seq_flds_add(a2x_fluxes,"Faxa_bcphiwet" ) + call seq_flds_add(x2i_fluxes,"Faxa_bcphiwet" ) + call seq_flds_add(x2l_fluxes,"Faxa_bcphiwet" ) + call seq_flds_add(x2o_fluxes,"Faxa_bcphiwet" ) + longname = 'Hydrophylic black carbon wet deposition flux' + stdname = 'wet_deposition_flux_of_hydrophylic_black_carbon' + units = 'kg m-2 s-1' + attname = 'Faxa_bcphiwet' + call metadata_set(attname, longname, stdname, units) + + ! Organic Carbon hydrophilic dry deposition + call seq_flds_add(a2x_fluxes,"Faxa_ocphidry" ) + call seq_flds_add(x2i_fluxes,"Faxa_ocphidry" ) + call seq_flds_add(x2l_fluxes,"Faxa_ocphidry" ) + call seq_flds_add(x2o_fluxes,"Faxa_ocphidry" ) + longname = 'Hydrophylic organic carbon dry deposition flux' + stdname = 'dry_deposition_flux_of_hydrophylic_organic_carbon' + units = 'kg m-2 s-1' + attname = 'Faxa_ocphidry' + call metadata_set(attname, longname, stdname, units) + + ! Organic Carbon hydrophobic dry deposition + call seq_flds_add(a2x_fluxes,"Faxa_ocphodry" ) + call seq_flds_add(x2i_fluxes,"Faxa_ocphodry" ) + call seq_flds_add(x2l_fluxes,"Faxa_ocphodry" ) + call seq_flds_add(x2o_fluxes,"Faxa_ocphodry" ) + longname = 'Hydrophobic organic carbon dry deposition flux' + stdname = 'dry_deposition_flux_of_hydrophobic_organic_carbon' + units = 'kg m-2 s-1' + attname = 'Faxa_ocphodry' + call metadata_set(attname, longname, stdname, units) + + ! Organic Carbon hydrophilic wet deposition + call seq_flds_add(a2x_fluxes,"Faxa_ocphiwet" ) + call seq_flds_add(x2i_fluxes,"Faxa_ocphiwet" ) + call seq_flds_add(x2l_fluxes,"Faxa_ocphiwet" ) + call seq_flds_add(x2o_fluxes,"Faxa_ocphiwet" ) + longname = 'Hydrophylic organic carbon wet deposition flux' + stdname = 'wet_deposition_flux_of_hydrophylic_organic_carbon' + units = 'kg m-2 s-1' + attname = 'Faxa_ocphiwet' + call metadata_set(attname, longname, stdname, units) + + ! Size 1 dust -- wet deposition + call seq_flds_add(a2x_fluxes,"Faxa_dstwet1" ) + call seq_flds_add(x2i_fluxes,"Faxa_dstwet1" ) + call seq_flds_add(x2l_fluxes,"Faxa_dstwet1" ) + call seq_flds_add(x2o_fluxes,"Faxa_dstwet1" ) + longname = 'Dust wet deposition flux (size 1)' + stdname = 'wet_deposition_flux_of_dust' + units = 'kg m-2 s-1' + attname = 'Faxa_dstwet1' + call metadata_set(attname, longname, stdname, units) + + ! Size 2 dust -- wet deposition + call seq_flds_add(a2x_fluxes,"Faxa_dstwet2" ) + call seq_flds_add(x2i_fluxes,"Faxa_dstwet2" ) + call seq_flds_add(x2l_fluxes,"Faxa_dstwet2" ) + call seq_flds_add(x2o_fluxes,"Faxa_dstwet2" ) + longname = 'Dust wet deposition flux (size 2)' + stdname = 'wet_deposition_flux_of_dust' + units = 'kg m-2 s-1' + attname = 'Faxa_dstwet2' + call metadata_set(attname, longname, stdname, units) + + ! Size 3 dust -- wet deposition + call seq_flds_add(a2x_fluxes,"Faxa_dstwet3" ) + call seq_flds_add(x2i_fluxes,"Faxa_dstwet3" ) + call seq_flds_add(x2l_fluxes,"Faxa_dstwet3" ) + call seq_flds_add(x2o_fluxes,"Faxa_dstwet3" ) + longname = 'Dust wet deposition flux (size 3)' + stdname = 'wet_deposition_flux_of_dust' + units = 'kg m-2 s-1' + attname = 'Faxa_dstwet3' + call metadata_set(attname, longname, stdname, units) + + ! Size 4 dust -- wet deposition + call seq_flds_add(a2x_fluxes,"Faxa_dstwet4" ) + call seq_flds_add(x2i_fluxes,"Faxa_dstwet4" ) + call seq_flds_add(x2l_fluxes,"Faxa_dstwet4" ) + call seq_flds_add(x2o_fluxes,"Faxa_dstwet4" ) + longname = 'Dust wet deposition flux (size 4)' + stdname = 'wet_deposition_flux_of_dust' + units = 'kg m-2 s-1' + attname = 'Faxa_dstwet4' + call metadata_set(attname, longname, stdname, units) + + ! Size 1 dust -- dry deposition + call seq_flds_add(a2x_fluxes,"Faxa_dstdry1" ) + call seq_flds_add(x2i_fluxes,"Faxa_dstdry1" ) + call seq_flds_add(x2l_fluxes,"Faxa_dstdry1" ) + call seq_flds_add(x2o_fluxes,"Faxa_dstdry1" ) + longname = 'Dust dry deposition flux (size 1)' + stdname = 'dry_deposition_flux_of_dust' + units = 'kg m-2 s-1' + attname = 'Faxa_dstdry1' + call metadata_set(attname, longname, stdname, units) + + ! Size 2 dust -- dry deposition + call seq_flds_add(a2x_fluxes,"Faxa_dstdry2" ) + call seq_flds_add(x2i_fluxes,"Faxa_dstdry2" ) + call seq_flds_add(x2l_fluxes,"Faxa_dstdry2" ) + call seq_flds_add(x2o_fluxes,"Faxa_dstdry2" ) + longname = 'Dust dry deposition flux (size 2)' + stdname = 'dry_deposition_flux_of_dust' + units = 'kg m-2 s-1' + attname = 'Faxa_dstdry2' + call metadata_set(attname, longname, stdname, units) + + ! Size 3 dust -- dry deposition + call seq_flds_add(a2x_fluxes,"Faxa_dstdry3" ) + call seq_flds_add(x2i_fluxes,"Faxa_dstdry3" ) + call seq_flds_add(x2l_fluxes,"Faxa_dstdry3" ) + call seq_flds_add(x2o_fluxes,"Faxa_dstdry3" ) + longname = 'Dust dry deposition flux (size 3)' + stdname = 'dry_deposition_flux_of_dust' + units = 'kg m-2 s-1' + attname = 'Faxa_dstdry3' + call metadata_set(attname, longname, stdname, units) + + ! Size 4 dust -- dry deposition + call seq_flds_add(a2x_fluxes,"Faxa_dstdry4" ) + call seq_flds_add(x2i_fluxes,"Faxa_dstdry4" ) + call seq_flds_add(x2l_fluxes,"Faxa_dstdry4" ) + call seq_flds_add(x2o_fluxes,"Faxa_dstdry4" ) + longname = 'Dust dry deposition flux (size 4)' + stdname = 'dry_deposition_flux_of_dust' + units = 'kg m-2 s-1' + attname = 'Faxa_dstdry4' + call metadata_set(attname, longname, stdname, units) + + !---------------------------------------------------------- + ! states/fluxes to atm (and ocean) + !---------------------------------------------------------- + + ! land/sea-ice/ocean fractions + call seq_flds_add(x2a_states,'Sf_lfrac') + call seq_flds_add(x2a_states,'Sf_ifrac') + call seq_flds_add(x2a_states,'Sf_ofrac') + longname = 'Surface land fraction' + stdname = 'land_area_fraction' + units = '1' + attname = 'Sf_lfrac' + call metadata_set(attname, longname, stdname, units) + longname = 'Surface ice fraction' + stdname = 'sea_ice_area_fraction' + attname = 'Sf_ifrac' + call metadata_set(attname, longname, stdname, units) + longname = 'Surface ocean fraction' + stdname = 'sea_area_fraction' + attname = 'Sf_ofrac' + call metadata_set(attname, longname, stdname, units) + + ! Direct albedo (visible radiation) + call seq_flds_add(i2x_states,"Si_avsdr") + call seq_flds_add(l2x_states,"Sl_avsdr") + call seq_flds_add(xao_albedo,"So_avsdr") + call seq_flds_add(x2a_states,"Sx_avsdr") + longname = 'Direct albedo (visible radiation)' + stdname = 'surface_direct_albedo_due_to_visible_radiation' + units = '1' + attname = 'Si_avsdr' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_avsdr' + call metadata_set(attname, longname, stdname, units) + attname = 'So_avsdr' + call metadata_set(attname, longname, stdname, units) + attname = 'Sx_avsdr' + call metadata_set(attname, longname, stdname, units) + + ! Direct albedo (near-infrared radiation) + call seq_flds_add(i2x_states,"Si_anidr") + call seq_flds_add(l2x_states,"Sl_anidr") + call seq_flds_add(xao_albedo,"So_anidr") + call seq_flds_add(x2a_states,"Sx_anidr") + longname = 'Direct albedo (near-infrared radiation)' + stdname = 'surface_direct_albedo_due_to_near_infrared_radiation' + units = '1' + attname = 'Si_anidr' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_anidr' + call metadata_set(attname, longname, stdname, units) + attname = 'So_anidr' + call metadata_set(attname, longname, stdname, units) + attname = 'Sx_anidr' + call metadata_set(attname, longname, stdname, units) + + ! Diffuse albedo (visible radiation) + call seq_flds_add(i2x_states,"Si_avsdf") + call seq_flds_add(l2x_states,"Sl_avsdf") + call seq_flds_add(xao_albedo,"So_avsdf") + call seq_flds_add(x2a_states,"Sx_avsdf") + longname = 'Diffuse albedo (visible radiation)' + stdname = 'surface_diffuse_albedo_due_to_visible_radiation' + units = '1' + attname = 'Si_avsdf' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_avsdf' + call metadata_set(attname, longname, stdname, units) + attname = 'So_avsdf' + call metadata_set(attname, longname, stdname, units) + attname = 'Sx_avsdf' + call metadata_set(attname, longname, stdname, units) + + ! Diffuse albedo (near-infrared radiation) + call seq_flds_add(i2x_states,"Si_anidf") + call seq_flds_add(l2x_states,"Sl_anidf") + call seq_flds_add(xao_albedo,"So_anidf") + call seq_flds_add(x2a_states,"Sx_anidf") + longname = 'Diffuse albedo (near-infrared radiation)' + stdname = 'surface_diffuse_albedo_due_to_near_infrared_radiation' + units = '1' + attname = 'Si_anidf' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_anidf' + call metadata_set(attname, longname, stdname, units) + attname = 'So_anidf' + call metadata_set(attname, longname, stdname, units) + attname = 'Sx_anidf' + call metadata_set(attname, longname, stdname, units) + + ! Reference temperature at 2 meters + call seq_flds_add(l2x_states,"Sl_tref") + call seq_flds_add(i2x_states,"Si_tref") + call seq_flds_add(xao_states,"So_tref") + call seq_flds_add(x2a_states,"Sx_tref") + longname = 'Reference temperature at 2 meters' + stdname = 'air_temperature' + units = 'K' + attname = 'Si_tref' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_tref' + call metadata_set(attname, longname, stdname, units) + attname = 'So_tref' + call metadata_set(attname, longname, stdname, units) + attname = 'Sx_tref' + call metadata_set(attname, longname, stdname, units) + + ! Reference specific humidity at 2 meters + call seq_flds_add(l2x_states,"Sl_qref") + call seq_flds_add(i2x_states,"Si_qref") + call seq_flds_add(xao_states,"So_qref") + call seq_flds_add(x2a_states,"Sx_qref") + longname = 'Reference specific humidity at 2 meters' + stdname = 'specific_humidity' + units = 'kg kg-1' + attname = 'Si_qref' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_qref' + call metadata_set(attname, longname, stdname, units) + attname = 'So_qref' + call metadata_set(attname, longname, stdname, units) + attname = 'Sx_qref' + call metadata_set(attname, longname, stdname, units) + + ! Surface temperature + call seq_flds_add(o2x_states,"So_t") + call seq_flds_add(l2x_states,"Sl_t") + call seq_flds_add(i2x_states,"Si_t") + call seq_flds_add(x2a_states,"Sx_t") + call seq_flds_add(x2a_states,"So_t") + call seq_flds_add(x2i_states,"So_t") + call seq_flds_add(x2w_states,"So_t") + longname = 'Surface temperature' + stdname = 'surface_temperature' + units = 'K' + attname = 'Si_t' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_t' + call metadata_set(attname, longname, stdname, units) + attname = 'So_t' + call metadata_set(attname, longname, stdname, units) + attname = 'Sx_t' + call metadata_set(attname, longname, stdname, units) + + ! Surface friction velocity in land (land/atm only) + call seq_flds_add(l2x_states,"Sl_fv") + call seq_flds_add(x2a_states,"Sl_fv") + longname = 'Surface fraction velocity in land' + stdname = 'fraction_velocity' + units = 'm s-1' + attname = 'Sl_fv' + call metadata_set(attname, longname, stdname, units) + + ! Aerodynamical resistance (land/atm only) + call seq_flds_add(l2x_states,"Sl_ram1") + call seq_flds_add(x2a_states,"Sl_ram1") + longname = 'aerodynamic resistance' + stdname = 'aerodynamic_resistance' + attname = 'Sl_ram1' + units = 's/m' + call metadata_set(attname, longname, stdname, units) + + + ! Surface snow water equivalent (land/atm only) + call seq_flds_add(l2x_states,"Sl_snowh") + call seq_flds_add(x2a_states,"Sl_snowh") + longname = 'Surface snow water equivalent' + stdname = 'surface_snow_water_equivalent' + units = 'm' + attname = 'Sl_snowh' + call metadata_set(attname, longname, stdname, units) + + ! Surface snow depth (ice/atm only) + call seq_flds_add(i2x_states,"Si_snowh") + call seq_flds_add(x2a_states,"Si_snowh") + longname = 'Surface snow depth' + stdname = 'surface_snow_thickness' + units = 'm' + attname = 'Si_snowh' + call metadata_set(attname, longname, stdname, units) + + ! Surface saturation specific humidity in ocean (ocn/atm only) + call seq_flds_add(xao_states,"So_ssq") + call seq_flds_add(x2a_states,"So_ssq") + longname = 'Surface saturation specific humidity in ocean' + stdname = 'specific_humidity_at_saturation' + units = 'kg kg-1' + attname = 'So_ssq' + call metadata_set(attname, longname, stdname, units) + + ! Square of exch. coeff (tracers) (ocn/atm only) + call seq_flds_add(xao_states,"So_re") + call seq_flds_add(x2a_states,"So_re") + longname = 'Square of exch. coeff (tracers)' + stdname = 'square_of_exch_coeff' + units = '1' + attname = 'So_re' + call metadata_set(attname, longname, stdname, units) + + ! 10 meter wind + call seq_flds_add(i2x_states,"Si_u10") + call seq_flds_add(xao_states,"So_u10") + call seq_flds_add(l2x_states,"Sl_u10") + call seq_flds_add(x2a_states,"Sx_u10") + longname = '10m wind' + stdname = '10m_wind' + units = 'm' + attname = 'Si_u10' + call metadata_set(attname, longname, stdname, units) + attname = 'So_u10' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_u10' + call metadata_set(attname, longname, stdname, units) + attname = 'Sx_u10' + call metadata_set(attname, longname, stdname, units) + + ! Zonal surface stress" + call seq_flds_add(l2x_fluxes,"Fall_taux") + call seq_flds_add(xao_fluxes,"Faox_taux") + call seq_flds_add(i2x_fluxes,"Faii_taux") + call seq_flds_add(x2a_fluxes,"Faxx_taux") + call seq_flds_add(i2x_fluxes,"Fioi_taux") + call seq_flds_add(x2o_fluxes,"Foxx_taux") + longname = 'Zonal surface stress' + stdname = 'surface_downward_eastward_stress' + units = 'N m-2' + attname = 'Fall_taux' + call metadata_set(attname, longname, stdname, units) + attname = 'Faox_taux' + call metadata_set(attname, longname, stdname, units) + attname = 'Faii_taux' + call metadata_set(attname, longname, stdname, units) + attname = 'Fioi_taux' + call metadata_set(attname, longname, stdname, units) + attname = 'Faxx_taux' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_taux' + call metadata_set(attname, longname, stdname, units) + + ! Meridional surface stress + call seq_flds_add(l2x_fluxes,"Fall_tauy") + call seq_flds_add(xao_fluxes,"Faox_tauy") + call seq_flds_add(i2x_fluxes,"Faii_tauy") + call seq_flds_add(x2a_fluxes,"Faxx_tauy") + call seq_flds_add(i2x_fluxes,"Fioi_tauy") + call seq_flds_add(x2o_fluxes,"Foxx_tauy") + longname = 'Meridional surface stress' + stdname = 'surface_downward_northward_stress' + units = 'N m-2' + attname = 'Fall_tauy' + call metadata_set(attname, longname, stdname, units) + attname = 'Faox_tauy' + call metadata_set(attname, longname, stdname, units) + attname = 'Faii_tauy' + call metadata_set(attname, longname, stdname, units) + attname = 'Fioi_tauy' + call metadata_set(attname, longname, stdname, units) + attname = 'Faxx_tauy' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_tauy' + call metadata_set(attname, longname, stdname, units) + + ! Surface latent heat flux + call seq_flds_add(l2x_fluxes,"Fall_lat") + call seq_flds_add(xao_fluxes,"Faox_lat") + call seq_flds_add(i2x_fluxes,"Faii_lat") + call seq_flds_add(x2a_fluxes,"Faxx_lat") + call seq_flds_add(x2o_fluxes,"Foxx_lat") + longname = 'Surface latent heat flux' + stdname = 'surface_upward_latent_heat_flux' + units = 'W m-2' + attname = 'Fall_lat' + call metadata_set(attname, longname, stdname, units) + attname = 'Faox_lat' + call metadata_set(attname, longname, stdname, units) + attname = 'Faii_lat' + call metadata_set(attname, longname, stdname, units) + attname = 'Faxx_lat' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_lat' + call metadata_set(attname, longname, stdname, units) + + ! Surface sensible heat flux + call seq_flds_add(l2x_fluxes,"Fall_sen") + call seq_flds_add(xao_fluxes,"Faox_sen") + call seq_flds_add(i2x_fluxes,"Faii_sen") + call seq_flds_add(x2a_fluxes,"Faxx_sen") + call seq_flds_add(x2o_fluxes,"Foxx_sen") + longname = 'Sensible heat flux' + stdname = 'surface_upward_sensible_heat_flux' + units = 'W m-2' + attname = 'Fall_sen' + call metadata_set(attname, longname, stdname, units) + attname = 'Faox_sen' + call metadata_set(attname, longname, stdname, units) + attname = 'Faii_sen' + call metadata_set(attname, longname, stdname, units) + attname = 'Faxx_sen' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_sen' + call metadata_set(attname, longname, stdname, units) + + ! Surface upward longwave heat flux + call seq_flds_add(l2x_fluxes,"Fall_lwup") + call seq_flds_add(xao_fluxes,"Faox_lwup") + call seq_flds_add(i2x_fluxes,"Faii_lwup") + call seq_flds_add(x2a_fluxes,"Faxx_lwup") + call seq_flds_add(x2o_fluxes,"Foxx_lwup") + longname = 'Surface upward longwave heat flux' + stdname = 'surface_net_upward_longwave_flux' + units = 'W m-2' + attname = 'Fall_lwup' + call metadata_set(attname, longname, stdname, units) + attname = 'Faox_lwup' + call metadata_set(attname, longname, stdname, units) + attname = 'Faii_lwup' + call metadata_set(attname, longname, stdname, units) + attname = 'Faxx_lwup' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_lwup' + call metadata_set(attname, longname, stdname, units) + + ! Evaporation water flux + call seq_flds_add(l2x_fluxes,"Fall_evap") + call seq_flds_add(xao_fluxes,"Faox_evap") + call seq_flds_add(i2x_fluxes,"Faii_evap") + call seq_flds_add(x2a_fluxes,"Faxx_evap") + call seq_flds_add(x2o_fluxes,"Foxx_evap") + longname = 'Evaporation water flux' + stdname = 'water_evaporation_flux' + units = 'kg m-2 s-1' + attname = 'Fall_evap' + call metadata_set(attname, longname, stdname, units) + attname = 'Faox_evap' + call metadata_set(attname, longname, stdname, units) + attname = 'Faii_evap' + call metadata_set(attname, longname, stdname, units) + attname = 'Faxx_evap' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_evap' + call metadata_set(attname, longname, stdname, units) + + ! Dust flux (particle bin number 1) + call seq_flds_add(l2x_fluxes,"Fall_flxdst1") + call seq_flds_add(x2a_fluxes,"Fall_flxdst1") + longname = 'Dust flux (particle bin number 1)' + stdname = 'dust_flux' + units = 'kg m-2 s-1' + attname = 'Fall_flxdst1' + call metadata_set(attname, longname, stdname, units) + + ! Dust flux (particle bin number 2) + call seq_flds_add(l2x_fluxes,"Fall_flxdst2") + call seq_flds_add(x2a_fluxes,"Fall_flxdst2") + longname = 'Dust flux (particle bin number 2)' + stdname = 'dust_flux' + units = 'kg m-2 s-1' + attname = 'Fall_flxdst2' + call metadata_set(attname, longname, stdname, units) + + ! Dust flux (particle bin number 3) + call seq_flds_add(l2x_fluxes,"Fall_flxdst3") + call seq_flds_add(x2a_fluxes,"Fall_flxdst3") + longname = 'Dust flux (particle bin number 3)' + stdname = 'dust_flux' + units = 'kg m-2 s-1' + attname = 'Fall_flxdst3' + call metadata_set(attname, longname, stdname, units) + + ! Dust flux (particle bin number 4) + call seq_flds_add(l2x_fluxes,"Fall_flxdst4") + call seq_flds_add(x2a_fluxes,"Fall_flxdst4") + longname = 'Dust flux (particle bin number 4)' + stdname = 'dust_flux' + units = 'kg m-2 s-1' + attname = 'Fall_flxdst4' + call metadata_set(attname, longname, stdname, units) + + !----------------------------- + ! atm<->ocn only exchange + !----------------------------- + + ! Sea level pressure (Pa) + call seq_flds_add(a2x_states,"Sa_pslv") + call seq_flds_add(x2o_states,"Sa_pslv") + longname = 'Sea level pressure' + stdname = 'air_pressure_at_sea_level' + units = 'Pa' + attname = 'Sa_pslv' + call metadata_set(attname, longname, stdname, units) + + ! Wind speed squared at 10 meters + call seq_flds_add(xao_states,"So_duu10n") + call seq_flds_add(x2o_states,"So_duu10n") + longname = 'Wind speed squared at 10 meters' + stdname = 'square_of_wind_speed' + units = 'm2 s-2' + attname = 'So_duu10n' + call metadata_set(attname, longname, stdname, units) + + ! Surface friction velocity in ocean + call seq_flds_add(xao_states,"So_ustar") + call seq_flds_add(x2a_states,"So_ustar") + longname = 'Surface fraction velocity in ocean' + stdname = 'fraction_velocity' + units = 'm s-1' + attname = 'So_ustar' + call metadata_set(attname, longname, stdname, units) + + !----------------------------- + ! ice<->ocn only exchange + !----------------------------- + + ! Fractional ice coverage wrt ocean + call seq_flds_add(i2x_states,"Si_ifrac") + call seq_flds_add(x2o_states,"Si_ifrac") + call seq_flds_add(x2w_states,"Si_ifrac") + longname = 'Fractional ice coverage wrt ocean' + stdname = 'sea_ice_area_fraction' + units = '1' + attname = 'Si_ifrac' + call metadata_set(attname, longname, stdname, units) + + if (trim(cime_model) == 'acme') then + ! Sea ice basal pressure + call seq_flds_add(i2x_states,"Si_bpress") + call seq_flds_add(x2o_states,"Si_bpress") + longname = 'Sea ice basal pressure' + stdname = 'cice_basal_pressure' + units = 'Pa' + attname = 'Si_bpress' + call metadata_set(attname, longname, stdname, units) + end if + + ! Ocean melt and freeze potential + call seq_flds_add(o2x_fluxes,"Fioo_q") + call seq_flds_add(x2i_fluxes,"Fioo_q") + longname = 'Ocean melt and freeze potential' + stdname = 'surface_snow_and_ice_melt_heat_flux' + units = 'W m-2' + attname = 'Fioo_q' + call metadata_set(attname, longname, stdname, units) + + if (trim(cime_model) == 'acme') then + ! Ocean melt (q<0) potential + call seq_flds_add(o2x_fluxes,"Fioo_meltp") + call seq_flds_add(x2i_fluxes,"Fioo_meltp") + longname = 'Ocean melt (q<0) potential' + stdname = 'surface_snow_and_ice_melt_heat_flux' + units = 'W m-2' + attname = 'Fioo_meltp' + call metadata_set(attname, longname, stdname, units) + end if + + if (trim(cime_model) == 'acme') then + ! Ocean frazil production + call seq_flds_add(o2x_fluxes,"Fioo_frazil") + call seq_flds_add(x2i_fluxes,"Fioo_frazil") + longname = 'Ocean frazil production' + stdname = 'ocean_frazil_ice_production' + units = 'kg m-2 s-1' + attname = 'Fioo_frazil' + call metadata_set(attname, longname, stdname, units) + end if + + ! Heat flux from melting + call seq_flds_add(i2x_fluxes,"Fioi_melth") + call seq_flds_add(x2o_fluxes,"Fioi_melth") + longname = 'Heat flux from melting' + stdname = 'surface_snow_melt_heat_flux' + units = 'W m-2' + attname = 'Fioi_melth' + call metadata_set(attname, longname, stdname, units) + + ! Water flux from melting + call seq_flds_add(i2x_fluxes,"Fioi_meltw") + call seq_flds_add(x2o_fluxes,"Fioi_meltw") + longname = 'Water flux due to melting' + stdname = 'surface_snow_melt_flux' + units = 'kg m-2 s-1' + attname = 'Fioi_meltw' + call metadata_set(attname, longname, stdname, units) + + ! Salt flux + call seq_flds_add(i2x_fluxes,"Fioi_salt") + call seq_flds_add(x2o_fluxes,"Fioi_salt") + longname = 'Salt flux' + stdname = 'virtual_salt_flux_into_sea_water' + units = 'kg m-2 s-1' + attname = 'Fioi_salt' + call metadata_set(attname, longname, stdname, units) + + ! Black Carbon hydrophilic deposition + call seq_flds_add(i2x_fluxes,"Fioi_bcphi" ) + call seq_flds_add(x2o_fluxes,"Fioi_bcphi" ) + longname = 'Hydrophylic black carbon deposition flux' + stdname = 'deposition_flux_of_hydrophylic_black_carbon' + units = 'kg m-2 s-1' + attname = 'Fioi_bcphi' + call metadata_set(attname, longname, stdname, units) + + ! Black Carbon hydrophobic deposition + call seq_flds_add(i2x_fluxes,"Fioi_bcpho" ) + call seq_flds_add(x2o_fluxes,"Fioi_bcpho" ) + longname = 'Hydrophobic black carbon deposition flux' + stdname = 'deposition_flux_of_hydrophobic_black_carbon' + units = 'kg m-2 s-1' + attname = 'Fioi_bcpho' + call metadata_set(attname, longname, stdname, units) + + ! Dust flux + call seq_flds_add(i2x_fluxes,"Fioi_flxdst") + call seq_flds_add(x2o_fluxes,"Fioi_flxdst") + longname = 'Dust flux' + stdname = 'dust_flux' + units = 'kg m-2 s-1' + attname = 'Fioi_flxdst' + call metadata_set(attname, longname, stdname, units) + + ! Sea surface salinity + call seq_flds_add(o2x_states,"So_s") + call seq_flds_add(x2i_states,"So_s") + longname = 'Sea surface salinity' + stdname = 'sea_surface_salinity' + units = 'g kg-1' + attname = 'So_s' + call metadata_set(attname, longname, stdname, units) + + ! Zonal sea water velocity + call seq_flds_add(o2x_states,"So_u") + call seq_flds_add(x2i_states,"So_u") + call seq_flds_add(x2w_states,"So_u") + longname = 'Zonal sea water velocity' + stdname = 'eastward_sea_water_velocity' + units = 'm s-1' + attname = 'So_u' + call metadata_set(attname, longname, stdname, units) + + ! Meridional sea water velocity + call seq_flds_add(o2x_states,"So_v") + call seq_flds_add(x2i_states,"So_v") + call seq_flds_add(x2w_states,"So_v") + longname = 'Meridional sea water velocity' + stdname = 'northward_sea_water_velocity' + units = 'm s-1' + attname = 'So_v' + call metadata_set(attname, longname, stdname, units) + + ! Zonal sea surface slope + call seq_flds_add(o2x_states,"So_dhdx") + call seq_flds_add(x2i_states,"So_dhdx") + longname = 'Zonal sea surface slope' + stdname = 'sea_surface_eastward_slope' + units = 'm m-1' + attname = 'So_dhdx' + call metadata_set(attname, longname, stdname, units) + + ! Meridional sea surface slope + call seq_flds_add(o2x_states,"So_dhdy") + call seq_flds_add(x2i_states,"So_dhdy") + longname = 'Meridional sea surface slope' + stdname = 'sea_surface_northward_slope' + units = 'm m-1' + attname = 'So_dhdy' + call metadata_set(attname, longname, stdname, units) + + ! Boundary Layer Depth + call seq_flds_add(o2x_states,"So_bldepth") + call seq_flds_add(x2w_states,"So_bldepth") + longname = 'Ocean Boundary Layer Depth' + stdname = 'ocean_boundary_layer_depth' + units = 'm' + attname = 'So_bldepth' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_states,"So_fswpen") + call seq_flds_add(o2x_states,"So_fswpen") + longname = 'Fraction of sw penetrating surface layer for diurnal cycle' + stdname = 'Fraction of sw penetrating surface layer for diurnal cycle' + units = '1' + attname = 'So_fswpen' + call metadata_set(attname, longname, stdname, units) + + !------------------------------ + ! ice<->ocn only exchange - BGC + !------------------------------ + if (trim(cime_model) == 'acme' .and. flds_bgc) then + + ! Ocean algae concentration 1 - diatoms? + call seq_flds_add(o2x_states,"So_algae1") + call seq_flds_add(x2i_states,"So_algae1") + longname = 'Ocean algae concentration 1 - diatoms' + stdname = 'ocean_algae_conc_1' + units = 'mmol C m-3' + attname = 'So_algae1' + call metadata_set(attname, longname, stdname, units) + + ! Ocean algae concentration 2 - flagellates? + call seq_flds_add(o2x_states,"So_algae2") + call seq_flds_add(x2i_states,"So_algae2") + longname = 'Ocean algae concentration 2 - flagellates' + stdname = 'ocean_algae_conc_2' + units = 'mmol C m-3' + attname = 'So_algae2' + call metadata_set(attname, longname, stdname, units) + + ! Ocean algae concentration 3 - phaeocyctis? + call seq_flds_add(o2x_states,"So_algae3") + call seq_flds_add(x2i_states,"So_algae3") + longname = 'Ocean algae concentration 3 - phaeocyctis' + stdname = 'ocean_algae_conc_3' + units = 'mmol C m-3' + attname = 'So_algae3' + call metadata_set(attname, longname, stdname, units) + + ! Ocean dissolved organic carbon concentration 1 - saccharides? + call seq_flds_add(o2x_states,"So_doc1") + call seq_flds_add(x2i_states,"So_doc1") + longname = 'Ocean dissolved organic carbon concentration 1 - saccharides' + stdname = 'ocean_dissolved_organic_carbon_conc_1' + units = 'mmol C m-3' + attname = 'So_doc1' + call metadata_set(attname, longname, stdname, units) + + ! Ocean dissolved organic carbon concentration 2 - lipids? + call seq_flds_add(o2x_states,"So_doc2") + call seq_flds_add(x2i_states,"So_doc2") + longname = 'Ocean dissolved organic carbon concentration 2 - lipids' + stdname = 'ocean_dissolved_organic_carbon_conc_2' + units = 'mmol C m-3' + attname = 'So_doc2' + call metadata_set(attname, longname, stdname, units) + + ! Ocean dissolved organic carbon concentration 3 - tbd? + call seq_flds_add(o2x_states,"So_doc3") + call seq_flds_add(x2i_states,"So_doc3") + longname = 'Ocean dissolved organic carbon concentration 3 - tbd' + stdname = 'ocean_dissolved_organic_carbon_conc_3' + units = 'mmol C m-3' + attname = 'So_doc3' + call metadata_set(attname, longname, stdname, units) + + ! Ocean dissolved inorganic carbon concentration 1 + call seq_flds_add(o2x_states,"So_dic1") + call seq_flds_add(x2i_states,"So_dic1") + longname = 'Ocean dissolved inorganic carbon concentration 1' + stdname = 'ocean_dissolved_inorganic_carbon_conc_1' + units = 'mmol C m-3' + attname = 'So_dic1' + call metadata_set(attname, longname, stdname, units) + + ! Ocean dissolved organic nitrogen concentration 1 + call seq_flds_add(o2x_states,"So_don1") + call seq_flds_add(x2i_states,"So_don1") + longname = 'Ocean dissolved organic nitrogen concentration 1' + stdname = 'ocean_dissolved_organic_nitrogen_conc_1' + units = 'mmol N m-3' + attname = 'So_don1' + call metadata_set(attname, longname, stdname, units) + + ! Ocean nitrate concentration + call seq_flds_add(o2x_states,"So_no3") + call seq_flds_add(x2i_states,"So_no3") + longname = 'Ocean nitrate concentration' + stdname = 'ocean_nitrate_conc' + units = 'mmol N m-3' + attname = 'So_no3' + call metadata_set(attname, longname, stdname, units) + + ! Ocean silicate concentration + call seq_flds_add(o2x_states,"So_sio3") + call seq_flds_add(x2i_states,"So_sio3") + longname = 'Ocean silicate concentration' + stdname = 'ocean_silicate_conc' + units = 'mmol Si m-3' + attname = 'So_sio3' + call metadata_set(attname, longname, stdname, units) + + ! Ocean ammonium concentration + call seq_flds_add(o2x_states,"So_nh4") + call seq_flds_add(x2i_states,"So_nh4") + longname = 'Ocean ammonium concentration' + stdname = 'ocean_ammonium_conc' + units = 'mmol N m-3' + attname = 'So_nh4' + call metadata_set(attname, longname, stdname, units) + + ! Ocean dimethyl sulfide (DMS) concentration + call seq_flds_add(o2x_states,"So_dms") + call seq_flds_add(x2i_states,"So_dms") + longname = 'Ocean dimethyl sulfide concentration' + stdname = 'ocean_dimethyl_sulfide_conc' + units = 'mmol S m-3' + attname = 'So_dms' + call metadata_set(attname, longname, stdname, units) + + ! Ocean dimethylsulphonio-propionate (DMSP) concentration + call seq_flds_add(o2x_states,"So_dmsp") + call seq_flds_add(x2i_states,"So_dmsp") + longname = 'Ocean dimethylsulphonio-propionate concentration' + stdname = 'ocean_dimethylsulphoniopropionate_conc' + units = 'mmol S m-3' + attname = 'So_dmsp' + call metadata_set(attname, longname, stdname, units) + + ! Ocean DOCr concentration + call seq_flds_add(o2x_states,"So_docr") + call seq_flds_add(x2i_states,"So_docr") + longname = 'Ocean DOCr concentration' + stdname = 'ocean_DOCr_conc' + units = 'mmol C m-3' + attname = 'So_docr' + call metadata_set(attname, longname, stdname, units) + + ! Ocean particulate iron concentration 1 + call seq_flds_add(o2x_states,"So_fep1") + call seq_flds_add(x2i_states,"So_fep1") + longname = 'Ocean particulate iron concentration 1' + stdname = 'ocean_particulate_iron_conc_1' + units = 'umol Fe m-3' + attname = 'So_fep1' + call metadata_set(attname, longname, stdname, units) + + ! Ocean particulate iron concentration 2 + call seq_flds_add(o2x_states,"So_fep2") + call seq_flds_add(x2i_states,"So_fep2") + longname = 'Ocean particulate iron concentration 2' + stdname = 'ocean_particulate_iron_conc_2' + units = 'umol Fe m-3' + attname = 'So_fep2' + call metadata_set(attname, longname, stdname, units) + + ! Ocean dissolved iron concentration 1 + call seq_flds_add(o2x_states,"So_fed1") + call seq_flds_add(x2i_states,"So_fed1") + longname = 'Ocean dissolved iron concentration 1' + stdname = 'ocean_dissolved_iron_conc_1' + units = 'umol Fe m-3' + attname = 'So_fed1' + call metadata_set(attname, longname, stdname, units) + + ! Ocean dissolved iron concentration 2 + call seq_flds_add(o2x_states,"So_fed2") + call seq_flds_add(x2i_states,"So_fed2") + longname = 'Ocean dissolved iron concentration 2' + stdname = 'ocean_dissolved_iron_conc_2' + units = 'umol Fe m-3' + attname = 'So_fed2' + call metadata_set(attname, longname, stdname, units) + + ! Ocean z-aerosol concentration 1 + call seq_flds_add(o2x_states,"So_zaer1") + call seq_flds_add(x2i_states,"So_zaer1") + longname = 'Ocean z-aerosol concentration 1' + stdname = 'ocean_z_aerosol_conc_1' + units = 'kg m-3' + attname = 'So_zaer1' + call metadata_set(attname, longname, stdname, units) + + ! Ocean z-aerosol concentration 2 + call seq_flds_add(o2x_states,"So_zaer2") + call seq_flds_add(x2i_states,"So_zaer2") + longname = 'Ocean z-aerosol concentration 2' + stdname = 'ocean_z_aerosol_conc_2' + units = 'kg m-3' + attname = 'So_zaer2' + call metadata_set(attname, longname, stdname, units) + + ! Ocean z-aerosol concentration 3 + call seq_flds_add(o2x_states,"So_zaer3") + call seq_flds_add(x2i_states,"So_zaer3") + longname = 'Ocean z-aerosol concentration 3' + stdname = 'ocean_z_aerosol_conc_3' + units = 'kg m-3' + attname = 'So_zaer3' + call metadata_set(attname, longname, stdname, units) + + ! Ocean z-aerosol concentration 4 + call seq_flds_add(o2x_states,"So_zaer4") + call seq_flds_add(x2i_states,"So_zaer4") + longname = 'Ocean z-aerosol concentration 4' + stdname = 'ocean_z_aerosol_conc_4' + units = 'kg m-3' + attname = 'So_zaer4' + call metadata_set(attname, longname, stdname, units) + + ! Ocean z-aerosol concentration 5 + call seq_flds_add(o2x_states,"So_zaer5") + call seq_flds_add(x2i_states,"So_zaer5") + longname = 'Ocean z-aerosol concentration 5' + stdname = 'ocean_z_aerosol_conc_5' + units = 'kg m-3' + attname = 'So_zaer5' + call metadata_set(attname, longname, stdname, units) + + ! Ocean z-aerosol concentration 6 + call seq_flds_add(o2x_states,"So_zaer6") + call seq_flds_add(x2i_states,"So_zaer6") + longname = 'Ocean z-aerosol concentration 6' + stdname = 'ocean_z_aerosol_conc_6' + units = 'kg m-3' + attname = 'So_zaer6' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice algae flux 1 - diatoms? + call seq_flds_add(i2x_fluxes,"Fioi_algae1") + call seq_flds_add(x2o_fluxes,"Fioi_algae1") + longname = 'Sea ice algae flux 1 - diatoms' + stdname = 'seaice_algae_flux_1' + units = 'mmol C m-2 s-1' + attname = 'Fioi_algae1' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice algae flux 2 - flagellates? + call seq_flds_add(i2x_fluxes,"Fioi_algae2") + call seq_flds_add(x2o_fluxes,"Fioi_algae2") + longname = 'Sea ice algae flux 2 - flagellates' + stdname = 'seaice_algae_flux_2' + units = 'mmol C m-2 s-1' + attname = 'Fioi_algae2' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice algae flux 3 - phaeocyctis? + call seq_flds_add(i2x_fluxes,"Fioi_algae3") + call seq_flds_add(x2o_fluxes,"Fioi_algae3") + longname = 'Sea ice algae flux 3 - phaeocyctis' + stdname = '_algae_flux_3' + units = 'mmol C m-2 s-1' + attname = 'Fioi_algae3' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice dissolved organic carbon flux 1 - saccharides? + call seq_flds_add(i2x_fluxes,"Fioi_doc1") + call seq_flds_add(x2o_fluxes,"Fioi_doc1") + longname = 'Sea ice dissolved organic carbon flux 1 - saccharides' + stdname = 'seaice_dissolved_organic_carbon_flux_1' + units = 'mmol C m-2 s-1' + attname = 'Fioi_doc1' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice dissolved organic carbon flux 2 - lipids? + call seq_flds_add(i2x_fluxes,"Fioi_doc2") + call seq_flds_add(x2o_fluxes,"Fioi_doc2") + longname = 'Sea ice dissolved organic carbon flux 2 - lipids' + stdname = 'seaice_dissolved_organic_carbon_flux_2' + units = 'mmol C m-2 s-1' + attname = 'Fioi_doc2' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice dissolved organic carbon flux 3 - tbd? + call seq_flds_add(i2x_fluxes,"Fioi_doc3") + call seq_flds_add(x2o_fluxes,"Fioi_doc3") + longname = 'Sea ice dissolved organic carbon flux 3 - tbd' + stdname = 'seaice_dissolved_organic_carbon_flux_3' + units = 'mmol C m-2 s-1' + attname = 'Fioi_doc3' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice dissolved inorganic carbon flux 1 + call seq_flds_add(i2x_fluxes,"Fioi_dic1") + call seq_flds_add(x2o_fluxes,"Fioi_dic1") + longname = 'Sea ice dissolved inorganic carbon flux 1' + stdname = 'seaice_dissolved_inorganic_carbon_flux_1' + units = 'mmol C m-2 s-1' + attname = 'Fioi_dic1' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice dissolved organic nitrogen flux 1 + call seq_flds_add(i2x_fluxes,"Fioi_don1") + call seq_flds_add(x2o_fluxes,"Fioi_don1") + longname = 'Sea ice dissolved organic nitrogen flux 1' + stdname = 'seaice_dissolved_organic_nitrogen_flux_1' + units = 'mmol N m-2 s-1' + attname = 'Fioi_don1' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice nitrate flux + call seq_flds_add(i2x_fluxes,"Fioi_no3") + call seq_flds_add(x2o_fluxes,"Fioi_no3") + longname = 'Sea ice nitrate flux' + stdname = 'seaice_nitrate_flux' + units = 'mmol N m-2 s-1' + attname = 'Fioi_no3' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice silicate flux + call seq_flds_add(i2x_fluxes,"Fioi_sio3") + call seq_flds_add(x2o_fluxes,"Fioi_sio3") + longname = 'Sea ice silicate flux' + stdname = 'seaice_silicate_flux' + units = 'mmol Si m-2 s-1' + attname = 'Fioi_sio3' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice ammonium flux + call seq_flds_add(i2x_fluxes,"Fioi_nh4") + call seq_flds_add(x2o_fluxes,"Fioi_nh4") + longname = 'Sea ice ammonium flux' + stdname = 'seaice_ammonium_flux' + units = 'mmol N m-2 s-1' + attname = 'Fioi_nh4' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice dimethyl sulfide (DMS) flux + call seq_flds_add(i2x_fluxes,"Fioi_dms") + call seq_flds_add(x2o_fluxes,"Fioi_dms") + longname = 'Sea ice dimethyl sulfide flux' + stdname = 'seaice_dimethyl_sulfide_flux' + units = 'mmol S m-2 s-1' + attname = 'Fioi_dms' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice DMSPp flux + call seq_flds_add(i2x_fluxes,"Fioi_dmspp") + call seq_flds_add(x2o_fluxes,"Fioi_dmspp") + longname = 'Sea ice DSMPp flux' + stdname = 'seaice_DSMPp_flux' + units = 'mmol S m-2 s-1' + attname = 'Fioi_dmspp' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice DMSPd flux + call seq_flds_add(i2x_fluxes,"Fioi_dmspd") + call seq_flds_add(x2o_fluxes,"Fioi_dmspd") + longname = 'Sea ice DSMPd flux' + stdname = 'seaice_DSMPd_flux' + units = 'mmol S m-2 s-1' + attname = 'Fioi_dmspd' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice DOCr flux + call seq_flds_add(i2x_fluxes,"Fioi_docr") + call seq_flds_add(x2o_fluxes,"Fioi_docr") + longname = 'Sea ice DOCr flux' + stdname = 'seaice_DOCr_flux' + units = 'mmol C m-2 s-1' + attname = 'Fioi_docr' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice particulate iron flux 1 + call seq_flds_add(i2x_fluxes,"Fioi_fep1") + call seq_flds_add(x2o_fluxes,"Fioi_fep1") + longname = 'Sea ice particulate iron flux 1' + stdname = 'seaice_particulate_iron_flux_1' + units = 'umol Fe m-2 s-1' + attname = 'Fioi_fep1' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice particulate iron flux 2 + call seq_flds_add(i2x_fluxes,"Fioi_fep2") + call seq_flds_add(x2o_fluxes,"Fioi_fep2") + longname = 'Sea ice particulate iron flux 2' + stdname = 'seaice_particulate_iron_flux_2' + units = 'umol Fe m-2 s-1' + attname = 'Fioi_fep2' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice dissolved iron flux 1 + call seq_flds_add(i2x_fluxes,"Fioi_fed1") + call seq_flds_add(x2o_fluxes,"Fioi_fed1") + longname = 'Sea ice dissolved iron flux 1' + stdname = 'seaice_dissolved_iron_flux_1' + units = 'umol Fe m-2 s-1' + attname = 'Fioi_fed1' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice dissolved iron flux 2 + call seq_flds_add(i2x_fluxes,"Fioi_fed2") + call seq_flds_add(x2o_fluxes,"Fioi_fed2") + longname = 'Sea ice dissolved iron flux 2' + stdname = 'seaice_dissolved_iron_flux_2' + units = 'umol Fe m-2 s-1' + attname = 'Fioi_fed2' + call metadata_set(attname, longname, stdname, units) + + ! Sea ice iron dust + call seq_flds_add(i2x_fluxes,"Fioi_dust1") + call seq_flds_add(x2o_fluxes,"Fioi_dust1") + longname = 'Sea ice iron dust 1' + stdname = 'seaice_iron_dust_1' + units = 'kg m-2 s-1' + attname = 'Fioi_dust1' + call metadata_set(attname, longname, stdname, units) + + endif + + + !----------------------------- + ! lnd->rof exchange + ! TODO: put in attributes below + !----------------------------- + + call seq_flds_add(l2x_fluxes,'Flrl_rofsur') + call seq_flds_add(x2r_fluxes,'Flrl_rofsur') + longname = 'Water flux from land (liquid surface)' + stdname = 'water_flux_into_runoff_surface' + units = 'kg m-2 s-1' + attname = 'Flrl_rofsur' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(l2x_fluxes,'Flrl_rofgwl') + call seq_flds_add(x2r_fluxes,'Flrl_rofgwl') + longname = 'Water flux from land (liquid glacier, wetland, and lake)' + stdname = 'water_flux_into_runoff_from_gwl' + units = 'kg m-2 s-1' + attname = 'Flrl_rofgwl' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(l2x_fluxes,'Flrl_rofsub') + call seq_flds_add(x2r_fluxes,'Flrl_rofsub') + longname = 'Water flux from land (liquid subsurface)' + stdname = 'water_flux_into_runoff_subsurface' + units = 'kg m-2 s-1' + attname = 'Flrl_rofsub' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(l2x_fluxes,'Flrl_rofdto') + call seq_flds_add(x2r_fluxes,'Flrl_rofdto') + longname = 'Water flux from land direct to ocean' + stdname = 'water_flux_direct_to_ocean' + units = 'kg m-2 s-1' + attname = 'Flrl_rofdto' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(l2x_fluxes,'Flrl_rofi') + call seq_flds_add(x2r_fluxes,'Flrl_rofi') + longname = 'Water flux from land (frozen)' + stdname = 'frozen_water_flux_into_runoff' + units = 'kg m-2 s-1' + attname = 'Flrl_rofi' + call metadata_set(attname, longname, stdname, units) + + ! Currently only the CESM land and runoff models treat irrigation as a separate + ! field: in ACME, this field is folded in to the other runoff fields. Eventually, + ! ACME may want to update its land and runoff models to map irrigation specially, as + ! CESM does. + ! + ! (Once ACME is using this irrigation field, all that needs to be done is to remove + ! this conditional: Code in other places in the coupler is written to trigger off of + ! whether Flrl_irrig has been added to the field list, so it should Just Work if this + ! conditional is removed.) + if (trim(cime_model) == 'cesm') then + ! Irrigation flux (land/rof only) + call seq_flds_add(l2x_fluxes,"Flrl_irrig") + call seq_flds_add(x2r_fluxes,"Flrl_irrig") + longname = 'Irrigation flux (withdrawal from rivers)' + stdname = 'irrigation' + units = 'kg m-2 s-1' + attname = 'Flrl_irrig' + call metadata_set(attname, longname, stdname, units) + end if + + !----------------------------- + ! rof->ocn (runoff) and rof->lnd (flooding) + !----------------------------- + + call seq_flds_add(r2x_fluxes,'Forr_rofl') + call seq_flds_add(x2o_fluxes,'Foxx_rofl') + call seq_flds_add(r2o_liq_fluxes,'Forr_rofl') + longname = 'Water flux due to runoff (liquid)' + stdname = 'water_flux_into_sea_water' + units = 'kg m-2 s-1' + attname = 'Forr_rofl' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_rofl' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(r2x_fluxes,'Forr_rofi') + call seq_flds_add(x2o_fluxes,'Foxx_rofi') + call seq_flds_add(r2o_ice_fluxes,'Forr_rofi') + longname = 'Water flux due to runoff (frozen)' + stdname = 'frozen_water_flux_into_sea_water' + units = 'kg m-2 s-1' + attname = 'Forr_rofi' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_rofi' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(r2x_fluxes,'Firr_rofi') + call seq_flds_add(x2i_fluxes,'Fixx_rofi') + longname = 'Water flux due to runoff (frozen)' + stdname = 'frozen_water_flux_into_sea_ice' + units = 'kg m-2 s-1' + attname = 'Firr_rofi' + call metadata_set(attname, longname, stdname, units) + attname = 'Fixx_rofi' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(r2x_fluxes,'Flrr_flood') + call seq_flds_add(x2l_fluxes,'Flrr_flood') + longname = 'Waterrflux due to flooding' + stdname = 'flooding_water_flux' + units = 'kg m-2 s-1' + attname = 'Flrr_flood' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(r2x_fluxes,'Flrr_volr') + call seq_flds_add(x2l_fluxes,'Flrr_volr') + longname = 'River channel total water volume' + stdname = 'rtm_volr' + units = 'm' + attname = 'Flrr_volr' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(r2x_fluxes,'Flrr_volrmch') + call seq_flds_add(x2l_fluxes,'Flrr_volrmch') + longname = 'River channel main channel water volume' + stdname = 'rtm_volrmch' + units = 'm' + attname = 'Flrr_volrmch' + call metadata_set(attname, longname, stdname, units) + + !----------------------------- + ! wav->ocn and ocn->wav + !----------------------------- + + call seq_flds_add(w2x_states,'Sw_lamult') + call seq_flds_add(x2o_states,'Sw_lamult') + longname = 'Langmuir multiplier' + stdname = 'wave_model_langmuir_multiplier' + units = '1' + attname = 'Sw_lamult' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(w2x_states,'Sw_ustokes') + call seq_flds_add(x2o_states,'Sw_ustokes') + longname = 'Stokes drift u component' + stdname = 'wave_model_stokes_drift_eastward_velocity' + units = 'm/s' + attname = 'Sw_ustokes' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(w2x_states,'Sw_vstokes') + call seq_flds_add(x2o_states,'Sw_vstokes') + longname = 'Stokes drift v component' + stdname = 'wave_model_stokes_drift_northward_velocity' + units = 'm/s' + attname = 'Sw_vstokes' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(w2x_states,'Sw_hstokes') + call seq_flds_add(x2o_states,'Sw_hstokes') + longname = 'Stokes drift depth' + stdname = 'wave_model_stokes_drift_depth' + units = 'm' + attname = 'Sw_hstokes' + call metadata_set(attname, longname, stdname, units) + + !----------------------------- + ! New xao_states diagnostic + ! fields for history output only + !----------------------------- + + call seq_flds_add(xao_fluxes,"Faox_swdn") + longname = 'Downward solar radiation' + stdname = 'surface_downward_shortwave_flux' + units = 'W m-2' + attname = 'Faox_swdn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_fluxes,"Faox_swup") + longname = 'Upward solar radiation' + stdname = 'surface_upward_shortwave_flux' + units = 'W m-2' + attname = 'Faox_swup' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_tbulk_diurn") + longname = 'atm/ocn flux temperature bulk' + stdname = 'aoflux_tbulk' + units = 'K' + attname = 'So_tbulk_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_tskin_diurn") + longname = 'atm/ocn flux temperature skin' + stdname = 'aoflux_tskin' + units = 'K' + attname = 'So_tskin_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_tskin_night_diurn") + longname = 'atm/ocn flux temperature skin at night' + stdname = 'aoflux_tskin_night' + units = 'K' + attname = 'So_tskin_night_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_tskin_day_diurn") + longname = 'atm/ocn flux temperature skin at day' + stdname = 'aoflux_tskin_day' + units = 'K' + attname = 'So_tskin_day_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_cskin_diurn") + longname = 'atm/ocn flux cool skin' + stdname = 'aoflux_cskin' + units = 'K' + attname = 'So_cskin_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_cskin_night_diurn") + longname = 'atm/ocn flux cool skin at night' + stdname = 'aoflux_cskin_night' + units = 'K' + attname = 'So_cskin_night_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_warm_diurn") + longname = 'atm/ocn flux warming' + stdname = 'aoflux_warm' + units = 'unitless' + attname = 'So_warm_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_salt_diurn") + longname = 'atm/ocn flux salting' + stdname = 'aoflux_salt' + units = 'unitless' + attname = 'So_salt_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_speed_diurn") + longname = 'atm/ocn flux speed' + stdname = 'aoflux_speed' + units = 'unitless' + attname = 'So_speed_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_regime_diurn") + longname = 'atm/ocn flux regime' + stdname = 'aoflux_regime' + units = 'unitless' + attname = 'So_regime_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_warmmax_diurn") + longname = 'atm/ocn flux warming dialy max' + stdname = 'aoflux_warmmax' + units = 'unitless' + attname = 'So_warmmax_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_windmax_diurn") + longname = 'atm/ocn flux wind daily max' + stdname = 'aoflux_windmax' + units = 'unitless' + attname = 'So_windmax_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_qsolavg_diurn") + longname = 'atm/ocn flux q-solar daily avg' + stdname = 'aoflux_qsolavg' + units = 'unitless' + attname = 'So_qsolavg_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_windavg_diurn") + longname = 'atm/ocn flux wind daily avg' + stdname = 'aoflux_windavg' + units = 'unitless' + attname = 'So_windavg_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_warmmaxinc_diurn") + longname = 'atm/ocn flux daily max increment' + stdname = 'aoflux_warmmaxinc' + units = 'unitless' + attname = 'So_warmmaxinc_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_windmaxinc_diurn") + longname = 'atm/ocn flux wind daily max increment' + stdname = 'aoflux_windmaxinc' + units = 'unitless' + attname = 'So_windmaxinc_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_qsolinc_diurn") + longname = 'atm/ocn flux q-solar increment' + stdname = 'aoflux_qsolinc' + units = 'unitless' + attname = 'So_qsolinc_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_windinc_diurn") + longname = 'atm/ocn flux wind increment' + stdname = 'aoflux_windinc' + units = 'unitless' + attname = 'So_windinc_diurn' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(xao_diurnl,"So_ninc_diurn") + longname = 'atm/ocn flux increment counter' + stdname = 'aoflux_ninc' + units = 'unitless' + attname = 'So_ninc_diurn' + call metadata_set(attname, longname, stdname, units) + + !----------------------------- + ! glc fields + !----------------------------- + + name = 'Fogg_rofl' + call seq_flds_add(g2x_fluxes,trim(name)) + longname = 'glc liquid runoff flux to ocean' + stdname = 'glacier_liquid_runoff_flux_to_ocean' + units = 'kg m-2 s-1' + attname = 'Fogg_rofl' + call metadata_set(attname, longname, stdname, units) + + name = 'Fogg_rofi' + call seq_flds_add(g2x_fluxes,trim(name)) + longname = 'glc frozen runoff flux to ocean' + stdname = 'glacier_frozen_runoff_flux_to_ocean' + units = 'kg m-2 s-1' + attname = 'Fogg_rofi' + call metadata_set(attname, longname, stdname, units) + + name = 'Figg_rofi' + call seq_flds_add(g2x_fluxes,trim(name)) + longname = 'glc frozen runoff_iceberg flux to ice' + stdname = 'glacier_frozen_runoff_flux_to_seaice' + units = 'kg m-2 s-1' + attname = 'Figg_rofi' + call metadata_set(attname, longname, stdname, units) + + name = 'Sg_icemask' + call seq_flds_add(g2x_states,trim(name)) + call seq_flds_add(g2x_states_to_lnd,trim(name)) + call seq_flds_add(x2l_states,trim(name)) + call seq_flds_add(x2l_states_from_glc,trim(name)) + longname = 'Ice sheet grid coverage on global grid' + stdname = 'ice_sheet_grid_mask' + units = '1' + attname = 'Sg_icemask' + call metadata_set(attname, longname, stdname, units) + + name = 'Sg_icemask_coupled_fluxes' + call seq_flds_add(g2x_states,trim(name)) + call seq_flds_add(g2x_states_to_lnd,trim(name)) + call seq_flds_add(x2l_states,trim(name)) + call seq_flds_add(x2l_states_from_glc,trim(name)) + longname = 'Ice sheet mask where we are potentially sending non-zero fluxes' + stdname = 'icemask_coupled_fluxes' + units = '1' + attname = 'Sg_icemask_coupled_fluxes' + call metadata_set(attname, longname, stdname, units) + + ! glc fields with multiple elevation classes: lnd->glc + ! + ! Note that these fields are sent in multiple elevation classes from lnd->cpl, but + ! the fields sent from cpl->glc do NOT have elevation classes + ! + ! Also note that we need to keep track of the l2x fields destined for glc in the + ! additional variables, l2x_fluxes_to_glc and l2x_states_to_glc. This is needed so that + ! we can set up an additional attribute vector holding accumulated quantities of just + ! these fields. (We can't determine these field lists with a call to + ! mct_aVect_initSharedFields, because the field names differ between l2x and x2g.) + + name = 'Flgl_qice' + longname = 'New glacier ice flux' + stdname = 'ice_flux_out_of_glacier' + units = 'kg m-2 s-1' + attname = 'Flgl_qice' + call set_glc_elevclass_field(name, attname, longname, stdname, units, l2x_fluxes) + call set_glc_elevclass_field(name, attname, longname, stdname, units, l2x_fluxes_to_glc, & + additional_list = .true.) + call seq_flds_add(x2g_fluxes,trim(name)) + call metadata_set(attname, longname, stdname, units) + + name = 'Sl_tsrf' + longname = 'Surface temperature of glacier' + stdname = 'surface_temperature' + units = 'deg C' + attname = 'Sl_tsrf' + call set_glc_elevclass_field(name, attname, longname, stdname, units, l2x_states) + call set_glc_elevclass_field(name, attname, longname, stdname, units, l2x_states_to_glc, & + additional_list = .true.) + call seq_flds_add(x2g_states,trim(name)) + call metadata_set(attname, longname, stdname, units) + + ! Sl_topo is sent from lnd -> cpl, but is NOT sent to glc (it is only used for the + ! remapping in the coupler) + name = 'Sl_topo' + longname = 'Surface height' + stdname = 'height' + units = 'm' + attname = 'Sl_topo' + call set_glc_elevclass_field(name, attname, longname, stdname, units, l2x_states) + call set_glc_elevclass_field(name, attname, longname, stdname, units, l2x_states_to_glc, & + additional_list = .true.) + + ! glc fields with multiple elevation classes: glc->lnd + ! + ! Note that the fields sent from glc->cpl do NOT have elevation classes, but the + ! fields from cpl->lnd are broken into multiple elevation classes + + name = 'Sg_ice_covered' + longname = 'Fraction of glacier area' + stdname = 'glacier_area_fraction' + units = '1' + attname = 'Sg_ice_covered' + call seq_flds_add(g2x_states,trim(name)) + call seq_flds_add(g2x_states_to_lnd,trim(name)) + call metadata_set(attname, longname, stdname, units) + call set_glc_elevclass_field(name, attname, longname, stdname, units, x2l_states) + call set_glc_elevclass_field(name, attname, longname, stdname, units, x2l_states_from_glc, & + additional_list = .true.) + + name = 'Sg_topo' + longname = 'Surface height of glacier' + stdname = 'height' + units = 'm' + attname = 'Sg_topo' + call seq_flds_add(g2x_states,trim(name)) + call seq_flds_add(g2x_states_to_lnd,trim(name)) + call metadata_set(attname, longname, stdname, units) + call set_glc_elevclass_field(name, attname, longname, stdname, units, x2l_states) + call set_glc_elevclass_field(name, attname, longname, stdname, units, x2l_states_from_glc, & + additional_list = .true.) + + name = 'Flgg_hflx' + longname = 'Downward heat flux from glacier interior' + stdname = 'downward_heat_flux_in_glacier' + units = 'W m-2' + attname = 'Flgg_hflx' + call seq_flds_add(g2x_fluxes,trim(name)) + call seq_flds_add(g2x_fluxes_to_lnd,trim(name)) + call metadata_set(attname, longname, stdname, units) + call set_glc_elevclass_field(name, attname, longname, stdname, units, x2l_fluxes) + call set_glc_elevclass_field(name, attname, longname, stdname, units, x2l_fluxes_from_glc, & + additional_list = .true.) + + ! Done glc fields + + if (flds_co2a) then + + call seq_flds_add(a2x_states, "Sa_co2prog") + call seq_flds_add(x2l_states, "Sa_co2prog") + call seq_flds_add(x2o_states, "Sa_co2prog") + longname = 'Prognostic CO2 at the lowest model level' + stdname = 'prognostic_CO2_lowest_level' + units = '1e-6 mol/mol' + attname = 'Sa_co2prog' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(a2x_states, "Sa_co2diag") + call seq_flds_add(x2l_states, "Sa_co2diag") + call seq_flds_add(x2o_states, "Sa_co2diag") + longname = 'Diagnostic CO2 at the lowest model level' + stdname = 'diagnostic_CO2_lowest_level' + units = '1e-6 mol/mol' + attname = 'Sa_co2diag' + call metadata_set(attname, longname, stdname, units) + + else if (flds_co2b) then + + call seq_flds_add(a2x_states, "Sa_co2prog") + call seq_flds_add(x2l_states, "Sa_co2prog") + longname = 'Prognostic CO2 at the lowest model level' + stdname = 'prognostic_CO2_lowest_level' + units = '1e-6 mol/mol' + attname = 'Sa_co2prog' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(a2x_states, "Sa_co2diag") + call seq_flds_add(x2l_states, "Sa_co2diag") + longname = 'Diagnostic CO2 at the lowest model level' + stdname = 'diagnostic_CO2_lowest_level' + units = '1e-6 mol/mol' + attname = 'Sa_co2diag' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(l2x_fluxes, "Fall_fco2_lnd") + call seq_flds_add(x2a_fluxes, "Fall_fco2_lnd") + longname = 'Surface flux of CO2 from land' + stdname = 'surface_upward_flux_of_carbon_dioxide_where_land' + units = 'moles m-2 s-1' + attname = 'Fall_fco2_lnd' + call metadata_set(attname, longname, stdname, units) + + else if (flds_co2c) then + + call seq_flds_add(a2x_states, "Sa_co2prog") + call seq_flds_add(x2l_states, "Sa_co2prog") + call seq_flds_add(x2o_states, "Sa_co2prog") + longname = 'Prognostic CO2 at the lowest model level' + stdname = 'prognostic_CO2_lowest_level' + units = '1e-6 mol/mol' + attname = 'Sa_co2prog' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(a2x_states, "Sa_co2diag") + call seq_flds_add(x2l_states, "Sa_co2diag") + call seq_flds_add(x2o_states, "Sa_co2diag") + longname = 'Diagnostic CO2 at the lowest model level' + stdname = 'diagnostic_CO2_lowest_level' + units = '1e-6 mol/mol' + attname = 'Sa_co2diag' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(l2x_fluxes, "Fall_fco2_lnd") + call seq_flds_add(x2a_fluxes, "Fall_fco2_lnd") + longname = 'Surface flux of CO2 from land' + stdname = 'surface_upward_flux_of_carbon_dioxide_where_land' + units = 'moles m-2 s-1' + attname = 'Fall_foc2_lnd' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(o2x_fluxes, "Faoo_fco2_ocn") + call seq_flds_add(x2a_fluxes, "Faoo_fco2_ocn") + longname = 'Surface flux of CO2 from ocean' + stdname = 'surface_upward_flux_of_carbon_dioxide_where_open_sea' + units = 'moles m-2 s-1' + attname = 'Faoo_fco2_ocn' + call metadata_set(attname, longname, stdname, units) + + else if (flds_co2_dmsa) then + + call seq_flds_add(a2x_states, "Sa_co2prog") + call seq_flds_add(x2l_states, "Sa_co2prog") + longname = 'Prognostic CO2 at the lowest model level' + stdname = 'prognostic_CO2_lowest_level' + units = '1e-6 mol/mol' + attname = 'Sa_co2prog' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(a2x_states, "Sa_co2diag") + call seq_flds_add(x2l_states, "Sa_co2diag") + longname = 'Diagnostic CO2 at the lowest model level' + stdname = 'diagnostic_CO2_lowest_level' + units = '1e-6 mol/mol' + attname = 'Sa_co2diag' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(o2x_fluxes, "Faoo_fdms_ocn") + call seq_flds_add(x2a_fluxes, "Faoo_fdms_ocn") + longname = 'Surface flux of DMS' + stdname = 'surface_upward_flux_of_dimethyl_sulfide' + units = 'moles m-2 s-1' + attname = 'Faoo_fdms' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(l2x_fluxes, "Fall_fco2_lnd") + call seq_flds_add(x2a_fluxes, "Fall_fco2_lnd") + longname = 'Surface flux of CO2 from land' + stdname = 'surface_upward_flux_of_carbon_dioxide_where_land' + units = 'moles m-2 s-1' + attname = 'Fall_foc2_lnd' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(o2x_fluxes, "Faoo_fco2_ocn") + call seq_flds_add(x2a_fluxes, "Faoo_fco2_ocn") + longname = 'Surface flux of CO2 from ocean' + stdname = 'surface_upward_flux_of_carbon_dioxide_where_open_sea' + units = 'moles m-2 s-1' + attname = 'Faoo_fco2_ocn' + call metadata_set(attname, longname, stdname, units) + + endif + + if (flds_wiso) then + call seq_flds_add(o2x_states, "So_roce_16O") + call seq_flds_add(x2i_states, "So_roce_16O") + longname = 'Ratio of ocean surface level abund. H2_16O/H2O/Rstd' + stdname = 'ratio_ocean_surface_16O_abund' + units = '1' + attname = 'So_roce_16O' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(o2x_states, "So_roce_18O") + call seq_flds_add(x2i_states, "So_roce_18O") + longname = 'Ratio of ocean surface level abund. H2_18O/H2O/Rstd' + attname = 'So_roce_18O' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(o2x_states, "So_roce_HDO") + call seq_flds_add(x2i_states, "So_roce_HDO") + longname = 'Ratio of ocean surface level abund. HDO/H2O/Rstd' + attname = 'So_roce_HDO' + call metadata_set(attname, longname, stdname, units) + + !-------------------------------------------- + !Atmospheric specific humidty at lowest level: + !-------------------------------------------- + + ! specific humidity of H216O at the lowest model level (kg/kg) + call seq_flds_add(a2x_states,"Sa_shum_16O") + call seq_flds_add(x2l_states,"Sa_shum_16O") + call seq_flds_add(x2i_states,"Sa_shum_16O") + longname = 'Specific humidty of H216O at the lowest model level' + stdname = 'H216OV' + units = 'kg kg-1' + attname = 'Sa_shum_16O' + call metadata_set(attname, longname, stdname, units) + + ! specific humidity of HD16O at the lowest model level (kg/kg) + call seq_flds_add(a2x_states,"Sa_shum_HDO") + call seq_flds_add(x2l_states,"Sa_shum_HDO") + call seq_flds_add(x2i_states,"Sa_shum_HDO") + longname = 'Specific humidty of HD16O at the lowest model level' + stdname = 'HD16OV' + attname = 'Sa_shum_HDO' + call metadata_set(attname, longname, stdname, units) + + ! specific humidity of H218O at the lowest model level (kg/kg) + call seq_flds_add(a2x_states,"Sa_shum_18O") + call seq_flds_add(x2l_states,"Sa_shum_18O") + call seq_flds_add(x2i_states,"Sa_shum_18O") + longname = 'Specific humidty of H218O at the lowest model level' + stdname = 'H218OV' + attname = 'Sa_shum_18O' + call metadata_set(attname, longname, stdname, units) + + ! Surface snow water equivalent (land/atm only) + call seq_flds_add(l2x_states,"Sl_snowh_16O") + call seq_flds_add(l2x_states,"Sl_snowh_18O") + call seq_flds_add(l2x_states,"Sl_snowh_HDO") + call seq_flds_add(x2a_states,"Sl_snowh_16O") + call seq_flds_add(x2a_states,"Sl_snowh_18O") + call seq_flds_add(x2a_states,"Sl_snowh_HDO") + longname = 'Isotopic surface snow water equivalent' + stdname = 'surface_snow_water_equivalent' + units = 'm' + attname = 'Sl_snowh_16O' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_snowh_18O' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_snowh_HDO' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_snowh_16O' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_snowh_18O' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_snowh_HDO' + call metadata_set(attname, longname, stdname, units) + + !-------------- + !Isotopic Rain: + !-------------- + + !Isotopic Precipitation Fluxes: + units = 'kg m-2 s-1' + call seq_flds_add(a2x_fluxes,"Faxa_rainc_16O") + call seq_flds_add(a2x_fluxes,"Faxa_rainl_16O") + call seq_flds_add(x2o_fluxes, "Faxa_rain_16O") + call seq_flds_add(x2l_fluxes,"Faxa_rainc_16O") + call seq_flds_add(x2l_fluxes,"Faxa_rainl_16O") + call seq_flds_add(x2i_fluxes, "Faxa_rain_16O") + longname = 'Water flux due to H216O rain' !equiv. to bulk + stdname = 'H2_16O_rainfall_flux' + attname = 'Faxa_rain_16O' + call metadata_set(attname, longname, stdname, units) + longname = 'H216O Convective precipitation rate' + stdname = 'H2_16O_convective_precipitation_flux' + attname = 'Faxa_rainc_16O' + call metadata_set(attname, longname, stdname, units) + longname = 'H216O Large-scale (stable) precipitation rate' + stdname = 'H2_16O_large_scale_precipitation_flux' + attname = 'Faxa_rainl_16O' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(a2x_fluxes,"Faxa_rainc_18O") + call seq_flds_add(a2x_fluxes,"Faxa_rainl_18O") + call seq_flds_add(x2o_fluxes, "Faxa_rain_18O") + call seq_flds_add(x2l_fluxes,"Faxa_rainc_18O") + call seq_flds_add(x2l_fluxes,"Faxa_rainl_18O") + call seq_flds_add(x2i_fluxes, "Faxa_rain_18O") + longname = 'Water flux due to H218O rain' + stdname = 'h2_18o_rainfall_flux' + attname = 'Faxa_rain_18O' + call metadata_set(attname, longname, stdname, units) + longname = 'H218O Convective precipitation rate' + stdname = 'H2_18O_convective_precipitation_flux' + attname = 'Faxa_rainc_18O' + call metadata_set(attname, longname, stdname, units) + longname = 'H218O Large-scale (stable) precipitation rate' + stdname = 'H2_18O_large_scale_precipitation_flux' + attname = 'Faxa_rainl_18O' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(a2x_fluxes,"Faxa_rainc_HDO") + call seq_flds_add(a2x_fluxes,"Faxa_rainl_HDO") + call seq_flds_add(x2o_fluxes, "Faxa_rain_HDO") + call seq_flds_add(x2l_fluxes,"Faxa_rainc_HDO") + call seq_flds_add(x2l_fluxes,"Faxa_rainl_HDO") + call seq_flds_add(x2i_fluxes, "Faxa_rain_HDO") + longname = 'Water flux due to HDO rain' + stdname = 'hdo_rainfall_flux' + attname = 'Faxa_rain_HDO' + call metadata_set(attname, longname, stdname, units) + longname = 'HDO Convective precipitation rate' + stdname = 'HDO_convective_precipitation_flux' + attname = 'Faxa_rainc_HDO' + call metadata_set(attname, longname, stdname, units) + longname = 'HDO Large-scale (stable) precipitation rate' + stdname = 'HDO_large_scale_precipitation_flux' + attname = 'Faxa_rainl_HDO' + call metadata_set(attname, longname, stdname, units) + + !------------- + !Isotopic snow: + !------------- + + call seq_flds_add(a2x_fluxes,"Faxa_snowc_16O") + call seq_flds_add(a2x_fluxes,"Faxa_snowl_16O") + call seq_flds_add(x2o_fluxes, "Faxa_snow_16O") + call seq_flds_add(x2l_fluxes,"Faxa_snowc_16O") + call seq_flds_add(x2l_fluxes,"Faxa_snowl_16O") + call seq_flds_add(x2i_fluxes, "Faxa_snow_16O") + longname = 'Water equiv. H216O snow flux' + stdname = 'h2_16o_snowfall_flux' + attname = 'Faxa_snow_16O' + call metadata_set(attname, longname, stdname, units) + longname = 'H2_16O Convective snow rate (water equivalent)' + stdname = 'H2_16O_convective_snowfall_flux' + attname = 'Faxa_snowc_16O' + call metadata_set(attname, longname, stdname, units) + longname = 'H2_16O Large-scale (stable) snow rate (water equivalent)' + stdname = 'H2_16O_large_scale_snowfall_flux' + attname = 'Faxa_snowl_16O' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(a2x_fluxes,"Faxa_snowc_18O") + call seq_flds_add(a2x_fluxes,"Faxa_snowl_18O") + call seq_flds_add(x2o_fluxes, "Faxa_snow_18O") + call seq_flds_add(x2l_fluxes,"Faxa_snowc_18O") + call seq_flds_add(x2l_fluxes,"Faxa_snowl_18O") + call seq_flds_add(x2i_fluxes, "Faxa_snow_18O") + longname = 'Isotopic water equiv. snow flux of H218O' + stdname = 'h2_18o_snowfall_flux' + attname = 'Faxa_snow_18O' + call metadata_set(attname, longname, stdname, units) + longname = 'H2_18O Convective snow rate (water equivalent)' + stdname = 'H2_18O_convective_snowfall_flux' + attname = 'Faxa_snowc_18O' + call metadata_set(attname, longname, stdname, units) + longname = 'H2_18O Large-scale (stable) snow rate (water equivalent)' + stdname = 'H2_18O_large_scale_snowfall_flux' + attname = 'Faxa_snowl_18O' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(a2x_fluxes,"Faxa_snowc_HDO") + call seq_flds_add(a2x_fluxes,"Faxa_snowl_HDO") + call seq_flds_add(x2o_fluxes, "Faxa_snow_HDO") + call seq_flds_add(x2l_fluxes,"Faxa_snowc_HDO") + call seq_flds_add(x2l_fluxes,"Faxa_snowl_HDO") + call seq_flds_add(x2i_fluxes, "Faxa_snow_HDO") + longname = 'Isotopic water equiv. snow flux of HDO' + stdname = 'hdo_snowfall_flux' + attname = 'Faxa_snow_HDO' + call metadata_set(attname, longname, stdname, units) + longname = 'HDO Convective snow rate (water equivalent)' + stdname = 'HDO_convective_snowfall_flux' + attname = 'Faxa_snowc_HDO' + call metadata_set(attname, longname, stdname, units) + longname = 'HDO Large-scale (stable) snow rate (water equivalent)' + stdname = 'HDO_large_scale_snowfall_flux' + attname = 'Faxa_snowl_HDO' + call metadata_set(attname, longname, stdname, units) + + !---------------------------------- + !Isotopic precipitation (rain+snow): + !---------------------------------- + + call seq_flds_add(x2o_fluxes,"Faxa_prec_16O") ! derived rain+snow + longname = 'Isotopic Water flux (rain+snow) for H2_16O' + stdname = 'h2_18o_precipitation_flux' + attname = 'Faxa_prec_16O' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(x2o_fluxes,"Faxa_prec_18O") ! derived rain+snow + longname = 'Isotopic Water flux (rain+snow) for H2_18O' + stdname = 'h2_18o_precipitation_flux' + units = 'kg m-2 s-1' + attname = 'Faxa_prec_18O' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(x2o_fluxes,"Faxa_prec_HDO") ! derived rain+snow + longname = 'Isotopic Water flux (rain+snow) for HD_O' + stdname = 'hdo_precipitation_flux' + units = 'kg m-2 s-1' + attname = 'Faxa_prec_HDO' + call metadata_set(attname, longname, stdname, units) + + !------------------------------------- + !Isotopic two meter reference humidity: + !------------------------------------- + + ! H216O Reference specific humidity at 2 meters + call seq_flds_add(l2x_states,"Sl_qref_16O") + call seq_flds_add(i2x_states,"Si_qref_16O") + call seq_flds_add(xao_states,"So_qref_16O") + call seq_flds_add(x2a_states,"Sx_qref_16O") + longname = 'Reference H216O specific humidity at 2 meters' + stdname = 'H216O_specific_humidity' + units = 'kg kg-1' + attname = 'Si_qref_16O' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_qref_16O' + call metadata_set(attname, longname, stdname, units) + attname = 'So_qref_16O' + call metadata_set(attname, longname, stdname, units) + attname = 'Sx_qref_16O' + call metadata_set(attname, longname, stdname, units) + + ! HD16O Reference specific humidity at 2 meters + call seq_flds_add(l2x_states,"Sl_qref_HDO") + call seq_flds_add(i2x_states,"Si_qref_HDO") + call seq_flds_add(xao_states,"So_qref_HDO") + call seq_flds_add(x2a_states,"Sx_qref_HDO") + longname = 'Reference HD16O specific humidity at 2 meters' + stdname = 'HD16O_specific_humidity' + units = 'kg kg-1' + attname = 'Si_qref_HDO' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_qref_HDO' + call metadata_set(attname, longname, stdname, units) + attname = 'So_qref_HDO' + call metadata_set(attname, longname, stdname, units) + attname = 'Sx_qref_HDO' + call metadata_set(attname, longname, stdname, units) + + ! H218O Reference specific humidity at 2 meters + call seq_flds_add(l2x_states,"Sl_qref_18O") + call seq_flds_add(i2x_states,"Si_qref_18O") + call seq_flds_add(xao_states,"So_qref_18O") + call seq_flds_add(x2a_states,"Sx_qref_18O") + longname = 'Reference H218O specific humidity at 2 meters' + stdname = 'H218O_specific_humidity' + units = 'kg kg-1' + attname = 'Si_qref_18O' + call metadata_set(attname, longname, stdname, units) + attname = 'Sl_qref_18O' + call metadata_set(attname, longname, stdname, units) + attname = 'So_qref_18O' + call metadata_set(attname, longname, stdname, units) + attname = 'Sx_qref_18O' + call metadata_set(attname, longname, stdname, units) + + !------------------------- + !Isotopic Evaporation flux: + !------------------------- + + ! H216O Evaporation water flux + call seq_flds_add(l2x_fluxes,"Fall_evap_16O") + call seq_flds_add(i2x_fluxes,"Faii_evap_16O") + call seq_flds_add(xao_fluxes,"Faox_evap_16O") + call seq_flds_add(x2a_fluxes,"Faxx_evap_16O") + call seq_flds_add(x2o_fluxes,"Foxx_evap_16O") + longname = 'Evaporation H216O flux' + stdname = 'H216O_evaporation_flux' + units = 'kg m-2 s-1' + attname = 'Fall_evap_16O' + call metadata_set(attname, longname, stdname, units) + attname = 'Faii_evap_16O' + call metadata_set(attname, longname, stdname, units) + attname = 'Faox_evap_16O' + call metadata_set(attname, longname, stdname, units) + attname = 'Faxx_evap_16O' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_evap_16O' + call metadata_set(attname, longname, stdname, units) + + ! HD16O Evaporation water flux + call seq_flds_add(l2x_fluxes,"Fall_evap_HDO") + call seq_flds_add(i2x_fluxes,"Faii_evap_HDO") + call seq_flds_add(xao_fluxes,"Faox_evap_HDO") + call seq_flds_add(x2a_fluxes,"Faxx_evap_HDO") + call seq_flds_add(x2o_fluxes,"Foxx_evap_HDO") + longname = 'Evaporation HD16O flux' + stdname = 'HD16O_evaporation_flux' + units = 'kg m-2 s-1' + attname = 'Fall_evap_HDO' + call metadata_set(attname, longname, stdname, units) + attname = 'Faii_evap_HDO' + call metadata_set(attname, longname, stdname, units) + attname = 'Faox_evap_HDO' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_evap_HDO' + call metadata_set(attname, longname, stdname, units) + attname = 'Faxx_evap_HDO' + call metadata_set(attname, longname, stdname, units) + + ! H218O Evaporation water flux + call seq_flds_add(l2x_fluxes,"Fall_evap_18O") + call seq_flds_add(i2x_fluxes,"Faii_evap_18O") + call seq_flds_add(xao_fluxes,"Faox_evap_18O") + call seq_flds_add(x2a_fluxes,"Faxx_evap_18O") + call seq_flds_add(x2o_fluxes,"Foxx_evap_18O") + longname = 'Evaporation H218O flux' + stdname = 'H218O_evaporation_flux' + units = 'kg m-2 s-1' + attname = 'Fall_evap_18O' + call metadata_set(attname, longname, stdname, units) + attname = 'Faii_evap_18O' + call metadata_set(attname, longname, stdname, units) + attname = 'Faox_evap_18O' + call metadata_set(attname, longname, stdname, units) + attname = 'Faxx_evap_18O' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_evap_18O' + call metadata_set(attname, longname, stdname, units) + + !----------------------------- + !Isotopic sea ice melting flux: + !----------------------------- + + ! H216O Water flux from melting + units = 'kg m-2 s-1' + call seq_flds_add(i2x_fluxes,"Fioi_meltw_16O") + call seq_flds_add(x2o_fluxes,"Fioi_meltw_16O") + longname = 'H2_16O flux due to melting' + stdname = 'h2_16o_surface_snow_melt_flux' + attname = 'Fioi_meltw_16O' + call metadata_set(attname, longname, stdname, units) + + ! H218O Water flux from melting + call seq_flds_add(i2x_fluxes,"Fioi_meltw_18O") + call seq_flds_add(x2o_fluxes,"Fioi_meltw_18O") + longname = 'H2_18O flux due to melting' + stdname = 'h2_18o_surface_snow_melt_flux' + attname = 'Fioi_meltw_18O' + call metadata_set(attname, longname, stdname, units) + + ! HDO Water flux from melting + units = 'kg m-2 s-1' + call seq_flds_add(i2x_fluxes,"Fioi_meltw_HDO") + call seq_flds_add(x2o_fluxes,"Fioi_meltw_HDO") + longname = 'HDO flux due to melting' + stdname = 'hdo_surface_snow_melt_flux' + attname = 'Fioi_meltw_HDO' + call metadata_set(attname, longname, stdname, units) + + !Iso-Runoff + ! r2o, l2x, x2r + + units = 'kg m-2 s-1' + call seq_flds_add(l2x_fluxes,'Flrl_rofi_16O') + call seq_flds_add(x2r_fluxes,'Flrl_rofi_16O') + longname = 'H2_16O Water flux from land (frozen)' + stdname = 'H2_16O_frozen_water_flux_into_runoff' + attname = 'Flrl_rofi_16O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(l2x_fluxes,'Flrl_rofi_18O') + call seq_flds_add(x2r_fluxes,'Flrl_rofi_18O') + longname = 'H2_18O Water flux from land (frozen)' + stdname = 'H2_18O_frozen_water_flux_into_runoff' + attname = 'Flrl_rofi_18O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(l2x_fluxes,'Flrl_rofi_HDO') + call seq_flds_add(x2r_fluxes,'Flrl_rofi_HDO') + longname = 'HDO Water flux from land (frozen)' + stdname = 'HDO_frozen_water_flux_into_runoff' + attname = 'Flrl_rofi_HDO' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(l2x_fluxes,'Flrl_rofl_16O') + call seq_flds_add(x2r_fluxes,'Flrl_rofl_16O') + longname = 'H2_16O Water flux from land (liquid)' + stdname = 'H2_16O_liquid_water_flux_into_runoff' + attname = 'Flrl_rofl_16O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(l2x_fluxes,'Flrl_rofl_18O') + call seq_flds_add(x2r_fluxes,'Flrl_rofl_18O') + longname = 'H2_18O Water flux from land (liquid)' + stdname = 'H2_18O_liquid_water_flux_into_runoff' + attname = 'Flrl_rofl_18O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(l2x_fluxes,'Flrl_rofl_HDO') + call seq_flds_add(x2r_fluxes,'Flrl_rofl_HDO') + longname = 'HDO Water flux from land (liquid)' + stdname = 'HDO_liquid_water_flux_into_runoff' + attname = 'Flrl_rofl_HDO' + call metadata_set(attname, longname, stdname, units) + + ! r2x, x2o + call seq_flds_add(r2x_fluxes,'Forr_rofl_16O') + call seq_flds_add(x2o_fluxes,'Foxx_rofl_16O') + call seq_flds_add(r2o_liq_fluxes,'Forr_rofl_16O') + longname = 'H2_16O Water flux due to liq runoff ' + stdname = 'H2_16O_water_flux_into_sea_water' + attname = 'Forr_rofl_16O' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_rofl_16O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(r2x_fluxes,'Forr_rofl_18O') + call seq_flds_add(x2o_fluxes,'Foxx_rofl_18O') + call seq_flds_add(r2o_liq_fluxes,'Forr_rofl_18O') + longname = 'H2_18O Water flux due to liq runoff ' + stdname = 'H2_18O_water_flux_into_sea_water' + attname = 'Forr_rofl_18O' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_rofl_18O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(r2x_fluxes,'Forr_rofl_HDO') + call seq_flds_add(x2o_fluxes,'Foxx_rofl_HDO') + call seq_flds_add(r2o_liq_fluxes,'Forr_rofl_HDO') + longname = 'HDO Water flux due to liq runoff ' + stdname = 'HDO_water_flux_into_sea_water' + attname = 'Forr_rofl_HDO' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_rofl_HDO' + call metadata_set(attname, longname, stdname, units) + + call seq_flds_add(r2x_fluxes,'Forr_rofi_16O') + call seq_flds_add(x2o_fluxes,'Foxx_rofi_16O') + call seq_flds_add(r2o_ice_fluxes,'Forr_rofi_16O') + longname = 'H2_16O Water flux due to ice runoff ' + stdname = 'H2_16O_water_flux_into_sea_water' + attname = 'Forr_rofi_16O' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_rofi_16O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(r2x_fluxes,'Forr_rofi_18O') + call seq_flds_add(x2o_fluxes,'Foxx_rofi_18O') + call seq_flds_add(r2o_ice_fluxes,'Forr_rofi_18O') + longname = 'H2_18O Water flux due to ice runoff ' + stdname = 'H2_18O_water_flux_into_sea_water' + attname = 'Forr_rofi_18O' + call metadata_set(attname, longname, stdname, units) + attname = 'Foxx_rofi_18O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(r2x_fluxes,'Forr_rofi_HDO') + call seq_flds_add(x2o_fluxes,'Foxx_rofi_HDO') + call seq_flds_add(r2o_ice_fluxes,'Forr_rofi_HDO') + longname = 'HDO Water flux due to ice runoff ' + stdname = 'HDO_water_flux_into_sea_water' + attname = 'Forr_rofi_HDO' + call metadata_set(attname, longname, stdname, units) + + ! r2x, x2l + call seq_flds_add(r2x_fluxes,'Flrr_flood_16O') + call seq_flds_add(x2l_fluxes,'Flrr_flood_16O') + longname = 'H2_16O waterrflux due to flooding' + stdname = 'H2_16O_flodding_water_flux_back_to_land' + attname = 'Flrr_flood_16O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(r2x_fluxes,'Flrr_flood_18O') + call seq_flds_add(x2l_fluxes,'Flrr_flood_18O') + longname = 'H2_18O waterrflux due to flooding' + stdname = 'H2_18O_flodding_water_flux_back_to_land' + attname = 'Flrr_flood_18O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(r2x_fluxes,'Flrr_flood_HDO') + call seq_flds_add(x2l_fluxes,'Flrr_flood_HDO') + longname = 'HDO Waterrflux due to flooding' + stdname = 'HDO_flodding_water_flux_back_to_land' + attname = 'Flrr_flood_HDO' + call metadata_set(attname, longname, stdname, units) + + units = 'm3' + call seq_flds_add(r2x_states,'Flrr_volr_16O') + call seq_flds_add(x2l_states,'Flrr_volr_16O') + longname = 'H2_16O river channel water volume ' + stdname = 'H2_16O_rtm_volr' + attname = 'Flrr_volr_16O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(r2x_states,'Flrr_volr_18O') + call seq_flds_add(x2l_states,'Flrr_volr_18O') + longname = 'H2_18O river channel water volume ' + stdname = 'H2_18O_rtm_volr' + attname = 'Flrr_volr_18O' + call metadata_set(attname, longname, stdname, units) + call seq_flds_add(r2x_states,'Flrr_volr_HDO') + call seq_flds_add(x2l_states,'Flrr_volr_HDO') + longname = 'HDO river channel water volume ' + stdname = 'HDO_rtm_volr' + attname = 'Flrr_volr_HDO' + call metadata_set(attname, longname, stdname, units) + + ! call seq_flds_add(r2x_fluxes,'Flrr_flood_HDO') + ! call seq_flds_add(x2l_fluxes,'Flrr_flood_HDO') + ! longname = 'H2_18O Waterrflux due to flooding' + ! stdname = 'H2_18O_flodding_water_flux_back_to_land' + ! attname = 'Flrr_flood_18O' + ! call metadata_set(attname, longname, stdname, units) + + !----------------------------- + + endif !Water isotopes + + !----------------------------------------------------------------------------- + ! optional per thickness category fields + !----------------------------------------------------------------------------- + + if (seq_flds_i2o_per_cat) then + do num = 1, ice_ncat + write(cnum,'(i2.2)') num + + ! Fractional ice coverage wrt ocean + + name = 'Si_ifrac_' // cnum + call seq_flds_add(i2x_states,name) + call seq_flds_add(x2o_states,name) + longname = 'fractional ice coverage wrt ocean for thickness category ' // cnum + stdname = 'sea_ice_area_fraction' + units = '1' + attname = name + call metadata_set(attname, longname, stdname, units) + + ! Net shortwave radiation + + name = 'PFioi_swpen_ifrac_' // cnum + call seq_flds_add(i2x_fluxes,name) + call seq_flds_add(x2o_fluxes,name) + longname = 'net shortwave radiation penetrating into ice and ocean times ice fraction for thickness category ' // cnum + stdname = 'product_of_net_downward_shortwave_flux_at_sea_water_surface_and_sea_ice_area_fraction' + units = 'W m-2' + attname = name + call metadata_set(attname, longname, stdname, units) + + end do + + ! Fractional atmosphere coverage wrt ocean + + name = 'Sf_afrac' + call seq_flds_add(x2o_states,name) + longname = 'fractional atmosphere coverage wrt ocean' + stdname = 'atmosphere_area_fraction' + units = '1' + attname = name + call metadata_set(attname, longname, stdname, units) + + name = 'Sf_afracr' + call seq_flds_add(x2o_states,name) + longname = 'fractional atmosphere coverage used in radiation computations wrt ocean' + stdname = 'atmosphere_area_fraction' + units = '1' + attname = name + call metadata_set(attname, longname, stdname, units) + + ! Net shortwave radiation + + name = 'Foxx_swnet_afracr' + call seq_flds_add(x2o_fluxes,name) + longname = 'net shortwave radiation times atmosphere fraction' + stdname = 'product_of_net_downward_shortwave_flux_at_sea_water_surface_and_atmosphere_area_fraction' + units = 'W m-2' + attname = name + call metadata_set(attname, longname, stdname, units) + endif + + !----------------------------------------------------------------------------- + ! Read namelist for CARMA + ! if carma_flds are specified then setup fields for CLM to CAM communication + !----------------------------------------------------------------------------- + + call shr_carma_readnl(nlfilename='drv_flds_in', carma_fields=carma_fields) + if (carma_fields /= ' ') then + call seq_flds_add(l2x_fluxes, trim(carma_fields)) + call seq_flds_add(x2a_fluxes, trim(carma_fields)) + longname = 'Volumetric soil water' + stdname = 'soil_water' + units = 'm3/m3' + call metadata_set(carma_fields, longname, stdname, units) + endif + + !----------------------------------------------------------------------------- + ! Read namelist for MEGAN + ! if MEGAN emission are specified then setup fields for CLM to CAM communication + ! (emissions fluxes) + !----------------------------------------------------------------------------- + + call shr_megan_readnl(nlfilename='drv_flds_in', ID=ID, megan_fields=megan_voc_fields) + if (shr_megan_mechcomps_n>0) then + call seq_flds_add(l2x_fluxes, trim(megan_voc_fields)) + call seq_flds_add(x2a_fluxes, trim(megan_voc_fields)) + longname = 'MEGAN emission fluxes' + stdname = 'megan_fluxes' + units = 'molecules/m2/sec' + call metadata_set(megan_voc_fields, longname, stdname, units) + endif + + !----------------------------------------------------------------------------- + ! Read namelist for Fire Emissions + ! if fire emission are specified then setup fields for CLM to CAM communication + ! (emissions fluxes) + !----------------------------------------------------------------------------- + + call shr_fire_emis_readnl(nlfilename='drv_flds_in', ID=ID, emis_fields=fire_emis_fields) + if (shr_fire_emis_mechcomps_n>0) then + call seq_flds_add(l2x_fluxes, trim(fire_emis_fields)) + call seq_flds_add(x2a_fluxes, trim(fire_emis_fields)) + longname = 'wild fire emission fluxes' + stdname = 'fire_emis' + units = 'kg/m2/sec' + call metadata_set(fire_emis_fields, longname, stdname, units) + + call seq_flds_add(l2x_states, trim(shr_fire_emis_ztop_token)) + call seq_flds_add(x2a_states, trim(shr_fire_emis_ztop_token)) + longname = 'wild fire plume height' + stdname = 'fire_plume_top' + units = 'm' + + call metadata_set(shr_fire_emis_ztop_token, longname, stdname, units) + endif + + !----------------------------------------------------------------------------- + ! Dry Deposition fields + ! First read namelist and figure out the drydep field list to pass + ! Then check if file exists and if not, n_drydep will be zero + ! Then add dry deposition fields to land export and atmosphere import states + ! Then initialize dry deposition fields + ! Note: CAM and CLM will then call seq_drydep_setHCoeff + !----------------------------------------------------------------------------- + + call seq_drydep_readnl(nlfilename="drv_flds_in", ID=ID, seq_drydep_fields=seq_drydep_fields) + if ( lnd_drydep ) then + call seq_flds_add(l2x_states, seq_drydep_fields) + call seq_flds_add(x2a_states, seq_drydep_fields) + + longname = 'dry deposition velocity' + stdname = 'drydep_vel' + units = 'cm/sec' + + call metadata_set(seq_drydep_fields, longname, stdname, units) + endif + call seq_drydep_init( ) + + !----------------------------------------------------------------------------- + ! Nitrogen Deposition fields + ! First read namelist and figure out the ndepdep field list to pass + ! Then check if file exists and if not, n_drydep will be zero + ! Then add nitrogen deposition fields to atm export, lnd import and ocn import + !----------------------------------------------------------------------------- + + call shr_ndep_readnl(nlfilename="drv_flds_in", ID=ID, ndep_fields=ndep_fields, add_ndep_fields=add_ndep_fields) + if (add_ndep_fields) then + call seq_flds_add(a2x_fluxes, ndep_fields) + call seq_flds_add(x2l_fluxes, ndep_fields) + call seq_flds_add(x2o_fluxes, ndep_fields) + + longname = 'nitrogen deposition flux' + stdname = 'nitrogen_deposition' + units = 'kg(N)/m2/sec' + + call metadata_set(ndep_fields, longname, stdname, units) + end if + + !---------------------------------------------------------------------------- + ! state + flux fields + !---------------------------------------------------------------------------- + + seq_flds_dom_coord = trim(dom_coord ) + seq_flds_a2x_states = trim(a2x_states) + seq_flds_x2a_states = trim(x2a_states) + seq_flds_i2x_states = trim(i2x_states) + seq_flds_x2i_states = trim(x2i_states) + seq_flds_l2x_states = trim(l2x_states) + seq_flds_l2x_states_to_glc = trim(l2x_states_to_glc) + seq_flds_x2l_states = trim(x2l_states) + seq_flds_x2l_states_from_glc = trim(x2l_states_from_glc) + seq_flds_o2x_states = trim(o2x_states) + seq_flds_x2o_states = trim(x2o_states) + seq_flds_g2x_states = trim(g2x_states) + seq_flds_g2x_states_to_lnd = trim(g2x_states_to_lnd) + seq_flds_x2g_states = trim(x2g_states) + seq_flds_xao_states = trim(xao_states) + seq_flds_xao_albedo = trim(xao_albedo) + seq_flds_xao_diurnl = trim(xao_diurnl) + seq_flds_r2x_states = trim(r2x_states) + seq_flds_x2r_states = trim(x2r_states) + seq_flds_w2x_states = trim(w2x_states) + seq_flds_x2w_states = trim(x2w_states) + + seq_flds_dom_other = trim(dom_other ) + seq_flds_a2x_fluxes = trim(a2x_fluxes) + seq_flds_x2a_fluxes = trim(x2a_fluxes) + seq_flds_i2x_fluxes = trim(i2x_fluxes) + seq_flds_x2i_fluxes = trim(x2i_fluxes) + seq_flds_l2x_fluxes = trim(l2x_fluxes) + seq_flds_l2x_fluxes_to_glc = trim(l2x_fluxes_to_glc) + seq_flds_x2l_fluxes = trim(x2l_fluxes) + seq_flds_x2l_fluxes_from_glc = trim(x2l_fluxes_from_glc) + seq_flds_o2x_fluxes = trim(o2x_fluxes) + seq_flds_x2o_fluxes = trim(x2o_fluxes) + seq_flds_g2x_fluxes = trim(g2x_fluxes) + seq_flds_g2x_fluxes_to_lnd = trim(g2x_fluxes_to_lnd) + seq_flds_x2g_fluxes = trim(x2g_fluxes) + seq_flds_xao_fluxes = trim(xao_fluxes) + seq_flds_r2x_fluxes = trim(r2x_fluxes) + seq_flds_x2r_fluxes = trim(x2r_fluxes) + seq_flds_w2x_fluxes = trim(w2x_fluxes) + seq_flds_x2w_fluxes = trim(x2w_fluxes) + seq_flds_r2o_liq_fluxes = trim(r2o_liq_fluxes) + seq_flds_r2o_ice_fluxes = trim(r2o_ice_fluxes) + + if (seq_comm_iamroot(ID)) then + write(llogunit,"(A)") subname//': seq_flds_a2x_states= ',trim(seq_flds_a2x_states) + write(llogunit,"(A)") subname//': seq_flds_a2x_fluxes= ',trim(seq_flds_a2x_fluxes) + write(llogunit,"(A)") subname//': seq_flds_x2a_states= ',trim(seq_flds_x2a_states) + write(llogunit,"(A)") subname//': seq_flds_x2a_fluxes= ',trim(seq_flds_x2a_fluxes) + write(llogunit,"(A)") subname//': seq_flds_l2x_states= ',trim(seq_flds_l2x_states) + write(llogunit,"(A)") subname//': seq_flds_l2x_fluxes= ',trim(seq_flds_l2x_fluxes) + write(llogunit,"(A)") subname//': seq_flds_x2l_states= ',trim(seq_flds_x2l_states) + write(llogunit,"(A)") subname//': seq_flds_x2l_fluxes= ',trim(seq_flds_x2l_fluxes) + write(llogunit,"(A)") subname//': seq_flds_i2x_states= ',trim(seq_flds_i2x_states) + write(llogunit,"(A)") subname//': seq_flds_i2x_fluxes= ',trim(seq_flds_i2x_fluxes) + write(llogunit,"(A)") subname//': seq_flds_x2i_states= ',trim(seq_flds_x2i_states) + write(llogunit,"(A)") subname//': seq_flds_x2i_fluxes= ',trim(seq_flds_x2i_fluxes) + write(llogunit,"(A)") subname//': seq_flds_o2x_states= ',trim(seq_flds_o2x_states) + write(llogunit,"(A)") subname//': seq_flds_o2x_fluxes= ',trim(seq_flds_o2x_fluxes) + write(llogunit,"(A)") subname//': seq_flds_x2o_states= ',trim(seq_flds_x2o_states) + write(llogunit,"(A)") subname//': seq_flds_x2o_fluxes= ',trim(seq_flds_x2o_fluxes) + write(llogunit,"(A)") subname//': seq_flds_g2x_states= ',trim(seq_flds_g2x_states) + write(llogunit,"(A)") subname//': seq_flds_g2x_fluxes= ',trim(seq_flds_g2x_fluxes) + write(llogunit,"(A)") subname//': seq_flds_x2g_states= ',trim(seq_flds_x2g_states) + write(llogunit,"(A)") subname//': seq_flds_x2g_fluxes= ',trim(seq_flds_x2g_fluxes) + write(llogunit,"(A)") subname//': seq_flds_xao_states= ',trim(seq_flds_xao_states) + write(llogunit,"(A)") subname//': seq_flds_xao_fluxes= ',trim(seq_flds_xao_fluxes) + write(llogunit,"(A)") subname//': seq_flds_xao_albedo= ',trim(seq_flds_xao_albedo) + write(llogunit,"(A)") subname//': seq_flds_xao_diurnl= ',trim(seq_flds_xao_diurnl) + write(llogunit,"(A)") subname//': seq_flds_r2x_states= ',trim(seq_flds_r2x_states) + write(llogunit,"(A)") subname//': seq_flds_r2x_fluxes= ',trim(seq_flds_r2x_fluxes) + write(llogunit,"(A)") subname//': seq_flds_x2r_states= ',trim(seq_flds_x2r_states) + write(llogunit,"(A)") subname//': seq_flds_x2r_fluxes= ',trim(seq_flds_x2r_fluxes) + write(llogunit,"(A)") subname//': seq_flds_w2x_states= ',trim(seq_flds_w2x_states) + write(llogunit,"(A)") subname//': seq_flds_w2x_fluxes= ',trim(seq_flds_w2x_fluxes) + write(llogunit,"(A)") subname//': seq_flds_x2w_states= ',trim(seq_flds_x2w_states) + write(llogunit,"(A)") subname//': seq_flds_x2w_fluxes= ',trim(seq_flds_x2w_fluxes) + end if + + call catFields(seq_flds_dom_fields, seq_flds_dom_coord , seq_flds_dom_other ) + call catFields(seq_flds_a2x_fields, seq_flds_a2x_states, seq_flds_a2x_fluxes) + call catFields(seq_flds_x2a_fields, seq_flds_x2a_states, seq_flds_x2a_fluxes) + call catFields(seq_flds_i2x_fields, seq_flds_i2x_states, seq_flds_i2x_fluxes) + call catFields(seq_flds_x2i_fields, seq_flds_x2i_states, seq_flds_x2i_fluxes) + call catFields(seq_flds_l2x_fields, seq_flds_l2x_states, seq_flds_l2x_fluxes) + call catFields(seq_flds_l2x_fields_to_glc, seq_flds_l2x_states_to_glc, seq_flds_l2x_fluxes_to_glc) + call catFields(seq_flds_x2l_fields, seq_flds_x2l_states, seq_flds_x2l_fluxes) + call catFields(seq_flds_x2l_fields_from_glc, seq_flds_x2l_states_from_glc, seq_flds_x2l_fluxes_from_glc) + call catFields(seq_flds_o2x_fields, seq_flds_o2x_states, seq_flds_o2x_fluxes) + call catFields(seq_flds_x2o_fields, seq_flds_x2o_states, seq_flds_x2o_fluxes) + call catFields(seq_flds_g2x_fields, seq_flds_g2x_states, seq_flds_g2x_fluxes) + call catFields(seq_flds_g2x_fields_to_lnd, seq_flds_g2x_states_to_lnd, seq_flds_g2x_fluxes_to_lnd) + call catFields(seq_flds_x2g_fields, seq_flds_x2g_states, seq_flds_x2g_fluxes) + call catFields(seq_flds_xao_fields, seq_flds_xao_albedo, seq_flds_xao_states) + call catFields(stringtmp , seq_flds_xao_fields, seq_flds_xao_fluxes) + call catFields(seq_flds_xao_fields, stringtmp , seq_flds_xao_diurnl) + call catFields(seq_flds_r2x_fields, seq_flds_r2x_states, seq_flds_r2x_fluxes) + call catFields(seq_flds_x2r_fields, seq_flds_x2r_states, seq_flds_x2r_fluxes) + call catFields(seq_flds_w2x_fields, seq_flds_w2x_states, seq_flds_w2x_fluxes) + call catFields(seq_flds_x2w_fields, seq_flds_x2w_states, seq_flds_x2w_fluxes) + + end subroutine seq_flds_set + + !=============================================================================== + !BOP =========================================================================== + ! + ! !IROUTINE: seq_flds_add + ! + ! !DESCRIPTION: + ! Returns new concatentated field list + ! in the output character string {\tt outfld}. + ! + ! !REVISION HISTORY: + ! 2011-Nov-27 - M. Vertenstein - first version + ! + ! !INTERFACE: ------------------------------------------------------------------ + + subroutine seq_flds_add(outfld, str) + + ! !USES: + + ! !INPUT/OUTPUT PARAMETERS: + + character(len=*),intent(in) :: str ! string + character(len=*),intent(inout) :: outfld ! output field name + + !EOP + + character(len=*),parameter :: subname = '(seq_flds_add) ' + !------------------------------------------------------------------------------- + ! + !------------------------------------------------------------------------------- + + if (trim(outfld) == '') then + outfld = trim(str) + else + outfld = trim(outfld)//':'//trim(str) + end if + if (len_trim(outfld) >= CXX) then + write(llogunit,*)'fields are = ',trim(outfld) + write(llogunit,*)'fields length = ',len_trim(outfld) + call shr_sys_abort(subname//'ERROR: maximum length of xxx_states or xxx_fluxes has been exceeded') + end if + + end subroutine seq_flds_add + + !=============================================================================== + !BOP =========================================================================== + ! + ! !IROUTINE: catFields + ! + ! !DESCRIPTION: + ! Returns {\tt nfld} concatentated field lists + ! in the output character string {\tt outfield}. + ! + ! !REVISION HISTORY: + ! 2003-Jan-24 - T. Craig - first version + ! + ! !INTERFACE: ------------------------------------------------------------------ + + subroutine catFields(outfield, str1, str2) + + ! !USES: + + ! !INPUT/OUTPUT PARAMETERS: + + character(len=*),intent(inout) :: outfield ! output field name + character(len=*),intent(in) :: str1 ! string1 + character(len=*),intent(in ) :: str2 ! string2 + + !EOP + + character(len=*),parameter :: subname = '(seq_flds_catFields) ' + !------------------------------------------------------------------------------- + ! + !------------------------------------------------------------------------------- + + outfield = '' + if (len_trim(str1) > 0 .and. len_trim(str2) > 0) then + if (len_trim(str1) + len_trim(str2) + 1 > len(outfield)) then + call shr_sys_abort(subname//' ERROR: maximum length of string has been exceeded sum') + endif + outfield = trim(str1)//':'//trim(str2) + else + if (len_trim(str1) > 0) then + if (len_trim(str1) > len(outfield)) then + call shr_sys_abort(subname//' ERROR: maximum length of string has been exceeded str1') + endif + outfield = trim(str1) + endif + if (len_trim(str2) > 0) then + if (len_trim(str2) > len(outfield)) then + call shr_sys_abort(subname//' ERROR: maximum length of string has been exceeded str2') + endif + outfield = trim(str2) + endif + endif + + end subroutine catFields + + !=============================================================================== + !BOP =========================================================================== + ! + ! !IROUTINE: seq_flds_getField + ! + ! !DESCRIPTION: + ! Returns {\tt nfld} element of the colon-delimited string {\tt cstring} + ! in the output character string {\tt outfield}. + ! + ! !REVISION HISTORY: + ! 2003-Jan-24 - T. Craig - first version + ! + ! !INTERFACE: ------------------------------------------------------------------ + + subroutine seq_flds_getField(outfield, nfld, cstring) + + ! !USES: + use mct_mod + + ! !INPUT/OUTPUT PARAMETERS: + + character(len=*),intent(out) :: outfield ! output field name + integer ,intent(in ) :: nfld ! field number + character(len=*),intent(in ) :: cstring ! colon delimited field string + + !EOP + + type(mct_list) :: mctIstr ! mct list from input cstring + type(mct_string) :: mctOStr ! mct string for output outfield + character(len=*),parameter :: subname = '(seq_flds_getField) ' + + !------------------------------------------------------------------------------- + ! + !------------------------------------------------------------------------------- + + outfield = '' + + call mct_list_init(mctIstr,cstring) + call mct_list_get(mctOStr,nfld,mctIstr) + outfield = mct_string_toChar(mctOStr) + call mct_list_clean(mctIstr) + call mct_string_clean(mctOStr) + + end subroutine seq_flds_getField + + !=============================================================================== +! If the attname passed in contains colons it is assumed to be a list of fields +! all of which have the same names and units + subroutine metadata_set(attname , longname, stdname , units ) + + ! !USES: + implicit none + + ! !INPUT/OUTPUT PARAMETERS: + character(len=*), intent(in) :: attname + character(len=*), intent(in) :: longname + character(len=*), intent(in) :: stdname + character(len=*), intent(in) :: units + + !EOP + character(len=*),parameter :: subname = '(seq_flds_metadata_set) ' + integer :: i, j + + i = index(attname,':') + j=1 + + do while(i>j .and. i<=len_trim(attname)) + n_entries = n_entries + 1 + lookup_entry(n_entries,1) = attname(j:i-1) + lookup_entry(n_entries,2) = trim(longname) + lookup_entry(n_entries,3) = trim(stdname ) + lookup_entry(n_entries,4) = trim(units ) + j=i+1 + i = index(attname(j:),':') + j - 1 + enddo + n_entries = n_entries + 1 + i = len_trim(attname) + lookup_entry(n_entries,1) = attname(j:i) + lookup_entry(n_entries,2) = trim(longname) + lookup_entry(n_entries,3) = trim(stdname ) + lookup_entry(n_entries,4) = trim(units ) + + + + + if (n_entries .ge. nmax) then + write(llogunit,*)'n_entries= ',n_entries,' nmax = ',nmax,' attname= ',trim(attname) + call shr_sys_abort(subname//'ERROR: nmax fields in lookup_entry table exceeded') + end if + + end subroutine metadata_set + + !=============================================================================== + + subroutine set_glc_elevclass_field(name, attname, longname, stdname, units, fieldlist, & + additional_list) + + ! Sets a coupling field for all glc elevation classes (1:glc_nec) plus bare land + ! (index 0). + ! + ! Note that, if glc_nec = 0, then we don't create any coupling fields (not even the + ! bare land (0) index) + ! + ! Puts the coupling fields in the given fieldlist, and also does the appropriate + ! metadata_set calls. + ! + ! additional_list should be .false. (or absent) the first time this is called for a + ! given set of coupling fields. However, if this same set of coupling fields is being + ! added to multiple field lists, then additional_list should be set to true for the + ! second and subsequent calls; in this case, the metadata_set calls are not done + ! (because they have already been done). + ! + ! name, attname and longname give the base name of the field; the elevation class + ! index will be appended as a suffix + + ! !USES: + use glc_elevclass_mod, only : glc_get_num_elevation_classes, glc_elevclass_as_string + + ! !INPUT/OUTPUT PARAMETERS: + character(len=*), intent(in) :: name ! base field name to add to fieldlist + character(len=*), intent(in) :: attname ! base field name for metadata + character(len=*), intent(in) :: longname ! base long name for metadata + character(len=*), intent(in) :: stdname ! standard name for metadata + character(len=*), intent(in) :: units ! units for metadata + character(len=*), intent(inout) :: fieldlist ! field list into which the fields should be added + + logical, intent(in), optional :: additional_list ! whether this is an additional list for the same set of coupling fields (see above for details; defaults to false) + + !EOP + integer :: num + character(len= 16) :: cnum + logical :: l_additional_list ! local version of the optional additional_list argument + + l_additional_list = .false. + if (present(additional_list)) then + l_additional_list = additional_list + end if + + if (glc_get_num_elevation_classes() > 0) then + do num = 0, glc_get_num_elevation_classes() + cnum = glc_elevclass_as_string(num) + + call seq_flds_add(fieldlist, trim(name) // trim(cnum)) + + if (.not. l_additional_list) then + call metadata_set(attname = trim(attname) // trim(cnum), & + longname = trim(longname) // ' of elevation class ' // trim(cnum), & + stdname = stdname, & + units = units) + end if + end do + end if + end subroutine set_glc_elevclass_field + + + subroutine seq_flds_get_num_entries(num_entries) + + ! !USES: + implicit none + + ! !INPUT/OUTPUT PARAMETERS: + integer, intent(out) :: num_entries + + character(len=*),parameter :: subname = '(seq_flds_get_num_entries) ' + + num_entries = n_entries + + end subroutine seq_flds_get_num_entries + + !=============================================================================== + + subroutine seq_flds_get_entry(nentry, shortname, longname, stdname, units) + + ! !USES: + implicit none + + ! !INPUT/OUTPUT PARAMETERS: + integer, intent(in) :: nentry + character(len=*),optional, intent(out) :: shortname + character(len=*),optional, intent(out) :: longname + character(len=*),optional, intent(out) :: stdname + character(len=*),optional, intent(out) :: units + + character(len=*),parameter :: subname = '(seq_flds_get_entry) ' + + if (present(shortname)) then + shortname = trim(lookup_entry(nentry,1)) + endif + + if (present(longname)) then + longname = trim(lookup_entry(nentry,2)) + endif + + if (present(stdname)) then + stdname = trim(lookup_entry(nentry,3)) + endif + + if (present(units)) then + units = trim(lookup_entry(nentry,4)) + endif + + end subroutine seq_flds_get_entry + + !=============================================================================== + + subroutine seq_flds_esmf_metadata_get(shortname, longname, stdname, units) + + ! !USES: + use shr_string_mod, only : shr_string_lastindex + implicit none + + ! !INPUT/OUTPUT PARAMETERS: + character(len=*), intent(in) :: shortname + character(len=*),optional, intent(out) :: longname + character(len=*),optional, intent(out) :: stdname + character(len=*),optional, intent(out) :: units + + !EOP + + !--- local --- + integer :: i,n + character(len=CSS) :: llongname, lstdname, lunits, lshortname ! local copies + character(len=*),parameter :: undef = 'undefined' + character(len=*),parameter :: unknown = 'unknown' + logical :: found + character(len=*),parameter :: subname = '(seq_flds_esmf_metadata_get) ' + + !--- define field metadata (name, long_name, standard_name, units) --- + + llongname = trim(unknown) + lstdname = trim(unknown) + lunits = trim(unknown) + + found = .false. + + if (.not.found) then + i = 1 + do while (i <= n_entries .and. .not.found) + lshortname = trim(shortname) + if (trim(lshortname) == trim(lookup_entry(i,1))) then + llongname = trim(lookup_entry(i,2)) + lstdname = trim(lookup_entry(i,3)) + lunits = trim(lookup_entry(i,4)) + found =.true. + end if + i = i + 1 + end do + endif + + if (.not.found) then + i = 1 + do while (i <= n_entries .and. .not.found) + n = shr_string_lastIndex(shortname,"_") + lshortname = "" + if (n < len_trim(shortname)) lshortname = shortname(n+1:len_trim(shortname)) + if (trim(lshortname) == trim(lookup_entry(i,1))) then + llongname = trim(lookup_entry(i,2)) + lstdname = trim(lookup_entry(i,3)) + lunits = trim(lookup_entry(i,4)) + found = .true. + end if + i = i + 1 + end do + endif + + if (present(longname)) then + longname = trim(llongname) + endif + if (present(stdname)) then + stdname = trim(lstdname) + endif + if (present(units)) then + units = trim(lunits) + endif + + end subroutine seq_flds_esmf_metadata_get + + !=============================================================================== + + end module seq_flds_mod + diff --git a/src/drivers/nuopc/shr/seq_infodata_mod.F90 b/src/drivers/nuopc/shr/seq_infodata_mod.F90 new file mode 100644 index 00000000000..729d6639ca2 --- /dev/null +++ b/src/drivers/nuopc/shr/seq_infodata_mod.F90 @@ -0,0 +1,1221 @@ +MODULE seq_infodata_mod + + ! !DESCRIPTION: A module to get, put, and store some standard scalar data + + ! !USES: + use ESMF + use NUOPC + + use shr_kind_mod, only: SHR_KIND_CS, SHR_KIND_CL, SHR_KIND_IN, SHR_KIND_R8, SHR_KIND_I8 + use shr_sys_mod, only: shr_sys_flush, shr_sys_abort, shr_sys_getenv + use shr_orb_mod, only: SHR_ORB_UNDEF_INT, SHR_ORB_UNDEF_REAL, shr_orb_params + + use seq_comm_mct, only: logunit, loglevel + use seq_comm_mct, only: seq_comm_setptrs, seq_comm_iamroot + use seq_comm_mct, only: num_inst_atm, num_inst_lnd, num_inst_rof + use seq_comm_mct, only: num_inst_ocn, num_inst_ice, num_inst_glc + use seq_comm_mct, only: num_inst_wav + + implicit none + + private ! default private + + ! !PUBLIC TYPES: + + public :: seq_infodata_type + + ! !PUBLIC MEMBER FUNCTIONS + + public :: seq_infodata_Init1 ! Initialize before clocks are initialized + public :: seq_infodata_Init2 ! Init after clocks are initialized + public :: seq_infodata_GetData ! Get values from infodata object + public :: seq_infodata_PutData ! Change values in infodata object + + ! !PUBLIC DATA MEMBERS: + public :: seq_infodata_infodata ! instance of infodata datatype + + ! Strings of valid start_type options + character(len=*), public, parameter :: seq_infodata_start_type_start = "startup" + character(len=*), public, parameter :: seq_infodata_start_type_cont = "continue" + character(len=*), public, parameter :: seq_infodata_start_type_brnch = "branch" + character(len=*), public, parameter :: seq_infodata_orb_fixed_year = 'fixed_year' + character(len=*), public, parameter :: seq_infodata_orb_variable_year = 'variable_year' + character(len=*), public, parameter :: seq_infodata_orb_fixed_parameters = 'fixed_parameters' + + ! Type to hold pause/resume signaling information + type seq_pause_resume_type + private + character(SHR_KIND_CL) :: atm_resume(num_inst_atm) = ' ' ! atm resume file + character(SHR_KIND_CL) :: lnd_resume(num_inst_lnd) = ' ' ! lnd resume file + character(SHR_KIND_CL) :: ice_resume(num_inst_ice) = ' ' ! ice resume file + character(SHR_KIND_CL) :: ocn_resume(num_inst_ocn) = ' ' ! ocn resume file + character(SHR_KIND_CL) :: glc_resume(num_inst_glc) = ' ' ! glc resume file + character(SHR_KIND_CL) :: rof_resume(num_inst_rof) = ' ' ! rof resume file + character(SHR_KIND_CL) :: wav_resume(num_inst_wav) = ' ' ! wav resume file + character(SHR_KIND_CL) :: cpl_resume = ' ' ! cpl resume file + end type seq_pause_resume_type + + ! InputInfo derived type + type seq_infodata_type + private ! This type is opaque + + !--- set via config attributes and held fixed ---- + character(SHR_KIND_CS) :: cime_model ! acme or cesm + character(SHR_KIND_CL) :: start_type ! Type of startup + character(SHR_KIND_CL) :: case_name ! Short case identification + character(SHR_KIND_CL) :: case_desc ! Long description of this case + character(SHR_KIND_CL) :: model_version ! Model version + character(SHR_KIND_CS) :: username ! Current user + character(SHR_KIND_CS) :: hostname ! Current machine + character(SHR_KIND_CL) :: timing_dir ! Dir for timing files + character(SHR_KIND_CL) :: tchkpt_dir ! Dir for timing checkpoint files + logical :: aqua_planet ! No ice/lnd, analytic ocn, perpetual time (cam aquaplanet testing mode only) + integer(SHR_KIND_IN) :: aqua_planet_sst = 1 ! aqua planet analytic sst type (cam aquaplanet testing mode only) + logical :: run_barriers ! barrier component run calls + logical :: brnch_retain_casename ! If branch and can use same casename + logical :: read_restart ! read the restart file, based on start_type (only for data models) + logical :: single_column ! single column mode + real (SHR_KIND_R8) :: scmlat ! single column lat + real (SHR_KIND_R8) :: scmlon ! single column lon + character(SHR_KIND_CS) :: logFilePostFix ! postfix for output log files + character(SHR_KIND_CL) :: outPathRoot ! root for output log files + logical :: perpetual = .false. ! perpetual flag + integer(SHR_KIND_IN) :: perpetual_ymd = -999 ! perpetual date + integer(SHR_KIND_IN) :: orb_iyear ! orbital year + integer(SHR_KIND_IN) :: orb_iyear_align ! model year associated with orb year + character(SHR_KIND_CL) :: orb_mode ! orbital mode + real(SHR_KIND_R8) :: orb_eccen ! See shr_orb_mod + real(SHR_KIND_R8) :: orb_obliq ! See shr_orb_mod + real(SHR_KIND_R8) :: orb_mvelp ! See shr_orb_mod + real(SHR_KIND_R8) :: orb_obliqr ! See shr_orb_mod + real(SHR_KIND_R8) :: orb_lambm0 ! See shr_orb_mod + real(SHR_KIND_R8) :: orb_mvelpp ! See shr_orb_mod + character(SHR_KIND_CS) :: tfreeze_option ! Freezing point calculation + character(SHR_KIND_CL) :: flux_epbal ! selects E,P,R adjustment technique + logical :: flux_albav ! T => no diurnal cycle in ocn albedos + logical :: flux_diurnal ! T => diurnal cycle in atm/ocn fluxes + real(SHR_KIND_R8) :: gust_fac ! wind gustiness factor + character(SHR_KIND_CL) :: glc_renormalize_smb ! Whether to renormalize smb sent from lnd -> glc + real(SHR_KIND_R8) :: wall_time_limit ! force stop time limit (hours) + integer :: cpl_decomp ! coupler decomp + character(SHR_KIND_CL) :: cpl_seq_option ! coupler sequencing option + logical :: cpl_cdf64 ! use netcdf 64 bit offset, large file support + logical :: drv_threading ! is threading control in driver turned on + + !--- set via namelist and may be time varying --- + integer(SHR_KIND_IN) :: info_debug ! debug level + logical :: bfbflag ! turn on bfb option + + !--- set via components and held fixed --- + logical :: atm_present ! does component model exist + logical :: atm_prognostic ! does component model need input data from driver + logical :: lnd_present ! does component model exist + logical :: lnd_prognostic ! does component model need input data from driver + logical :: rof_present ! does rof component exist + logical :: rofice_present ! does rof have iceberg coupling on + logical :: rof_prognostic ! does rof component need input data + logical :: flood_present ! does rof have flooding on + logical :: ocn_present ! does component model exist + logical :: ocn_prognostic ! does component model need input data from driver + logical :: ocnrof_prognostic ! does component need rof data + logical :: ice_present ! does component model exist + logical :: ice_prognostic ! does component model need input data from driver + logical :: iceberg_prognostic ! does the ice model support icebergs + logical :: glc_present ! does component model exist + logical :: glclnd_present ! does glc have land coupling fields on + logical :: glcocn_present ! does glc have ocean runoff on + logical :: glcice_present ! does glc have iceberg coupling on + logical :: glc_prognostic ! does component model need input data from driver + logical :: glc_coupled_fluxes ! does glc send fluxes to other components (only relevant if glc_present is .true.) + logical :: wav_present ! does component model exist + logical :: wav_prognostic ! does component model need input data from driver + logical :: esp_present ! does component model exist + logical :: esp_prognostic ! does component model need input data from driver + logical :: dead_comps ! do we have dead models + integer(SHR_KIND_IN) :: atm_nx ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: atm_ny ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: lnd_nx ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: lnd_ny ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: ice_nx ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: ice_ny ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: ocn_nx ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: ocn_ny ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: rof_nx ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: rof_ny ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: glc_nx ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: glc_ny ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: wav_nx ! nx, ny of "2d" grid + integer(SHR_KIND_IN) :: wav_ny ! nx, ny of "2d" grid + + !--- set via components and may be time varying --- + real(SHR_KIND_R8) :: nextsw_cday = -1.0_SHR_KIND_R8 ! calendar of next atm shortwave + real(SHR_KIND_R8) :: precip_fact = 1.0_SHR_KIND_R8 ! precip factor + integer(SHR_KIND_IN) :: atm_phase = 1 ! atm phase + integer(SHR_KIND_IN) :: lnd_phase = 1 ! lnd phase + integer(SHR_KIND_IN) :: ice_phase = 1 ! ice phase + integer(SHR_KIND_IN) :: ocn_phase = 1 ! ocn phase + integer(SHR_KIND_IN) :: glc_phase = 1 ! glc phase + integer(SHR_KIND_IN) :: rof_phase = 1 ! rof phase + integer(SHR_KIND_IN) :: wav_phase = 1 ! wav phase + integer(SHR_KIND_IN) :: esp_phase = 1 ! esp phase + logical :: atm_aero = .false. ! atmosphere aerosols + logical :: glc_g2lupdate = .false. ! update glc2lnd fields in lnd model + real(shr_kind_r8) :: max_cplstep_time ! abort if cplstep time exceeds this value + type(seq_pause_resume_type), pointer :: pause_resume => NULL() + + !--- set by driver and may be time varying + logical :: glc_valid_input = .true. ! is valid accumulated data being sent to prognostic glc + + !--- set from restart file --- + character(SHR_KIND_CL) :: rest_case_name ! Short case identification + + end type seq_infodata_type + + type (seq_infodata_type), target :: seq_infodata_infodata ! single instance for cpl and all comps + + ! --- public interfaces -------------------------------------------------------- + interface seq_infodata_GetData + module procedure seq_infodata_GetData_explicit + end interface seq_infodata_GetData + + interface seq_infodata_PutData + module procedure seq_infodata_PutData_explicit + end interface seq_infodata_PutData + !=============================================================================== + +CONTAINS + + !=============================================================================== + SUBROUTINE seq_infodata_Init1(infodata, driver, ID) + + ! !DESCRIPTION: + ! Read in input from driver attributes and output derived type for miscillaneous info. + + ! !USES: + use seq_timemgr_mod, only : seq_timemgr_pause_active + + ! !INPUT/OUTPUT PARAMETERS: + type(seq_infodata_type), intent(INOUT) :: infodata ! infodata object + type(ESMF_GridComp) , intent(INOUT) :: driver + integer(SHR_KIND_IN), intent(IN) :: ID ! seq_comm ID + + !----- local ----- + character(len=*), parameter :: subname = '(seq_infodata_Init1) ' + !------------------------------------------------------------------------------- + + !--------------------------------------------------------------- + ! Set via components during runtime and may be time varying + !--------------------------------------------------------------- + + if (associated(infodata%pause_resume)) then + deallocate(infodata%pause_resume) + end if + nullify(infodata%pause_resume) + + !----------------------------------------------------- + ! Set cam aquaplanet relevant flags + !----------------------------------------------------- + + if (seq_comm_iamroot(ID)) then + if (infodata%aqua_planet) then + infodata%perpetual = .true. + infodata%perpetual_ymd = 321 + endif + end if + + end SUBROUTINE seq_infodata_Init1 + + !=============================================================================== + SUBROUTINE seq_infodata_Init2(infodata) + + ! !DESCRIPTION: Initialize infodata items that depend on the time manager setup + + ! !USES: + use seq_timemgr_mod, only : seq_timemgr_pause_active + + ! !INPUT/OUTPUT PARAMETERS: + type(seq_infodata_type), intent(INOUT) :: infodata ! infodata object + !---------------------------------------------------------- + + !| If pause/resume is active, initialize the resume data + if (seq_timemgr_pause_active() .and. (.not. associated(infodata%pause_resume))) then + allocate(infodata%pause_resume) + end if + + END SUBROUTINE seq_infodata_Init2 + + !=============================================================================== + SUBROUTINE seq_infodata_GetData_explicit( infodata, & + cime_model , & + case_name , & + case_desc , & + timing_dir , & + model_version , & + username , & + hostname , & + rest_case_name , & + tchkpt_dir , & + start_type , & + perpetual , & + perpetual_ymd , & + aqua_planet , & + aqua_planet_sst , & + brnch_retain_casename , & + read_restart , & ! only for data modes + single_column , & + scmlat , & + scmlon , & + logFilePostFix , & + outPathRoot , & + atm_present , & + atm_prognostic , & + lnd_present , & + lnd_prognostic , & + rof_prognostic , & + rof_present , & + ocn_present , & + ocn_prognostic , & + ocnrof_prognostic , & + ice_present , & + ice_prognostic , & + glc_present , & + glc_prognostic , & + glc_coupled_fluxes , & + flood_present , & + wav_present , & + wav_prognostic , & + rofice_present , & + glclnd_present , & + glcocn_present , & + glcice_present , & + iceberg_prognostic , & + esp_present , & + esp_prognostic , & + bfbflag , & + cpl_decomp , & + cpl_seq_option , & + info_debug , & + dead_comps , & + flux_epbalfact , & + nextsw_cday , & + precip_fact , & + flux_epbal , & + flux_albav , & + glc_g2lupdate , & + atm_aero , & + run_barriers , & + drv_threading , & + flux_diurnal , & + gust_fac , & + wall_time_limit , & + cpl_cdf64 , & + orb_iyear , & + orb_iyear_align , & + orb_mode , & + orb_mvelp , & + orb_eccen , & + orb_obliqr , & + orb_obliq , & + orb_lambm0 , & + orb_mvelpp , & + tfreeze_option , & + glc_renormalize_smb , & + glc_phase , & + rof_phase , & + atm_phase , & + lnd_phase , & + ocn_phase , & + ice_phase , & + wav_phase , & + esp_phase , & + wav_nx , & + wav_ny , & + atm_nx , & + atm_ny , & + lnd_nx , & + lnd_ny , & + rof_nx , & + rof_ny , & + ice_nx , & + ice_ny , & + ocn_nx , & + ocn_ny , & + glc_nx , & + glc_ny , & + atm_resume , & + lnd_resume , & + ocn_resume , & + ice_resume , & + glc_resume , & + rof_resume , & + wav_resume , & + cpl_resume , & + max_cplstep_time , & + glc_valid_input) + + implicit none + + ! !DESCRIPTION:! Get values out of the infodata object. + + ! !INPUT/OUTPUT PARAMETERS: + + type(seq_infodata_type), intent(IN) :: infodata ! Input CCSM structure + character(len=*), optional, intent(OUT) :: cime_model ! CIME model (acme or cesm) + character(len=*), optional, intent(OUT) :: start_type ! Start type + character(len=*), optional, intent(OUT) :: case_name ! Short case identification + character(len=*), optional, intent(OUT) :: case_desc ! Long case description + character(len=*), optional, intent(OUT) :: model_version ! Model version + character(len=*), optional, intent(OUT) :: username ! Username + character(len=*), optional, intent(OUT) :: hostname ! Hostname + character(len=*), optional, intent(OUT) :: rest_case_name ! restart casename + character(len=*), optional, intent(OUT) :: timing_dir ! timing dir name + character(len=*), optional, intent(OUT) :: tchkpt_dir ! timing checkpoint dir name + logical, optional, intent(OUT) :: aqua_planet ! aqua_planet mode + integer(SHR_KIND_IN), optional, intent(OUT) :: aqua_planet_sst ! aqua_planet sst_type + logical, optional, intent(OUT) :: run_barriers ! barrier component run calls + logical, optional, intent(OUT) :: brnch_retain_casename + logical, optional, intent(OUT) :: read_restart ! read restart flag (only for data models) + logical, optional, intent(OUT) :: single_column + real (SHR_KIND_R8), optional, intent(OUT) :: scmlat + real (SHR_KIND_R8), optional, intent(OUT) :: scmlon + character(len=*), optional, intent(OUT) :: logFilePostFix ! output log file postfix + character(len=*), optional, intent(OUT) :: outPathRoot ! output file root + logical, optional, intent(OUT) :: perpetual ! If this is perpetual + integer, optional, intent(OUT) :: perpetual_ymd ! If perpetual, date + character(len=*), optional, intent(OUT) :: orb_mode ! orbital mode + integer, optional, intent(OUT) :: orb_iyear ! orbital year + integer, optional, intent(OUT) :: orb_iyear_align ! orbital year model year align + real(SHR_KIND_R8), optional, intent(OUT) :: orb_eccen ! See shr_orb_mod + real(SHR_KIND_R8), optional, intent(OUT) :: orb_obliqr ! See shr_orb_mod + real(SHR_KIND_R8), optional, intent(OUT) :: orb_obliq ! See shr_orb_mod + real(SHR_KIND_R8), optional, intent(OUT) :: orb_lambm0 ! See shr_orb_mod + real(SHR_KIND_R8), optional, intent(OUT) :: orb_mvelpp ! See shr_orb_mod + real(SHR_KIND_R8), optional, intent(OUT) :: orb_mvelp ! See shr_orb_mod + character(len=*), optional, intent(OUT) :: tfreeze_option ! Freezing point of salt water + character(len=*), optional, intent(OUT) :: flux_epbal ! selects E,P,R adjustment technique + logical, optional, intent(OUT) :: flux_albav ! T => no diurnal cycle in ocn albedos + logical, optional, intent(OUT) :: flux_diurnal ! T => diurnal cycle in atm/ocn flux + real(SHR_KIND_R8), optional, intent(OUT) :: gust_fac ! wind gustiness factor + character(len=*), optional, intent(OUT) :: glc_renormalize_smb ! Whether to renormalize smb sent from lnd -> glc + real(SHR_KIND_R8), optional, intent(OUT) :: wall_time_limit ! force stop wall time (hours) + integer, optional, intent(OUT) :: cpl_decomp ! coupler decomp + character(len=*), optional, intent(OUT) :: cpl_seq_option ! coupler sequencing option + logical, optional, intent(OUT) :: cpl_cdf64 ! netcdf large file setting + logical, optional, intent(OUT) :: drv_threading ! driver threading control flag + + integer(SHR_KIND_IN), optional, intent(OUT) :: info_debug + logical, optional, intent(OUT) :: bfbflag + logical, optional, intent(OUT) :: dead_comps ! do we have dead models + + logical, optional, intent(OUT) :: atm_present ! provide data + logical, optional, intent(OUT) :: atm_prognostic ! need data + logical, optional, intent(OUT) :: lnd_present + logical, optional, intent(OUT) :: lnd_prognostic + logical, optional, intent(OUT) :: rof_present + logical, optional, intent(OUT) :: rofice_present + logical, optional, intent(OUT) :: rof_prognostic + logical, optional, intent(OUT) :: flood_present + logical, optional, intent(OUT) :: ocn_present + logical, optional, intent(OUT) :: ocn_prognostic + logical, optional, intent(OUT) :: ocnrof_prognostic + logical, optional, intent(OUT) :: ice_present + logical, optional, intent(OUT) :: ice_prognostic + logical, optional, intent(OUT) :: iceberg_prognostic + logical, optional, intent(OUT) :: glc_present + logical, optional, intent(OUT) :: glclnd_present + logical, optional, intent(OUT) :: glcocn_present + logical, optional, intent(OUT) :: glcice_present + logical, optional, intent(OUT) :: glc_prognostic + logical, optional, intent(OUT) :: glc_coupled_fluxes + logical, optional, intent(OUT) :: wav_present + logical, optional, intent(OUT) :: wav_prognostic + logical, optional, intent(OUT) :: esp_present + logical, optional, intent(OUT) :: esp_prognostic + integer(SHR_KIND_IN), optional, intent(OUT) :: atm_nx ! nx,ny 2d grid size global + integer(SHR_KIND_IN), optional, intent(OUT) :: atm_ny ! nx,ny 2d grid size global + integer(SHR_KIND_IN), optional, intent(OUT) :: lnd_nx + integer(SHR_KIND_IN), optional, intent(OUT) :: lnd_ny + integer(SHR_KIND_IN), optional, intent(OUT) :: rof_nx + integer(SHR_KIND_IN), optional, intent(OUT) :: rof_ny + integer(SHR_KIND_IN), optional, intent(OUT) :: ice_nx + integer(SHR_KIND_IN), optional, intent(OUT) :: ice_ny + integer(SHR_KIND_IN), optional, intent(OUT) :: ocn_nx + integer(SHR_KIND_IN), optional, intent(OUT) :: ocn_ny + integer(SHR_KIND_IN), optional, intent(OUT) :: glc_nx + integer(SHR_KIND_IN), optional, intent(OUT) :: glc_ny + integer(SHR_KIND_IN), optional, intent(OUT) :: wav_nx + integer(SHR_KIND_IN), optional, intent(OUT) :: wav_ny + real(SHR_KIND_R8), optional, intent(OUT) :: nextsw_cday ! calendar of next atm shortwave + real(SHR_KIND_R8), optional, intent(OUT) :: precip_fact ! precip factor + real(SHR_KIND_R8), optional, intent(OUT) :: flux_epbalfact ! adjusted precip factor + integer(SHR_KIND_IN), optional, intent(OUT) :: atm_phase ! atm phase + integer(SHR_KIND_IN), optional, intent(OUT) :: lnd_phase ! lnd phase + integer(SHR_KIND_IN), optional, intent(OUT) :: ice_phase ! ice phase + integer(SHR_KIND_IN), optional, intent(OUT) :: ocn_phase ! ocn phase + integer(SHR_KIND_IN), optional, intent(OUT) :: glc_phase ! glc phase + integer(SHR_KIND_IN), optional, intent(OUT) :: rof_phase ! rof phase + integer(SHR_KIND_IN), optional, intent(OUT) :: wav_phase ! wav phase + integer(SHR_KIND_IN), optional, intent(OUT) :: esp_phase ! wav phase + logical, optional, intent(OUT) :: atm_aero ! atmosphere aerosols + logical, optional, intent(OUT) :: glc_g2lupdate ! update glc2lnd fields in lnd model + real(shr_kind_r8), optional, intent(out) :: max_cplstep_time + logical, optional, intent(OUT) :: glc_valid_input + character(SHR_KIND_CL), optional, intent(OUT) :: atm_resume(:) ! atm read resume state + character(SHR_KIND_CL), optional, intent(OUT) :: lnd_resume(:) ! lnd read resume state + character(SHR_KIND_CL), optional, intent(OUT) :: ice_resume(:) ! ice read resume state + character(SHR_KIND_CL), optional, intent(OUT) :: ocn_resume(:) ! ocn read resume state + character(SHR_KIND_CL), optional, intent(OUT) :: glc_resume(:) ! glc read resume state + character(SHR_KIND_CL), optional, intent(OUT) :: rof_resume(:) ! rof read resume state + character(SHR_KIND_CL), optional, intent(OUT) :: wav_resume(:) ! wav read resume state + character(SHR_KIND_CL), optional, intent(OUT) :: cpl_resume ! cpl read resume state + + !----- local ----- + character(len=*), parameter :: subname = '(seq_infodata_GetData_explicit) ' + + !------------------------------------------------------------------------------- + + if ( present(cime_model) ) cime_model = infodata%cime_model + if ( present(start_type) ) start_type = infodata%start_type + if ( present(case_name) ) case_name = infodata%case_name + if ( present(case_desc) ) case_desc = infodata%case_desc + if ( present(model_version) ) model_version = infodata%model_version + if ( present(username) ) username = infodata%username + if ( present(hostname) ) hostname = infodata%hostname + if ( present(rest_case_name) ) rest_case_name = infodata%rest_case_name + if ( present(timing_dir) ) timing_dir = infodata%timing_dir + if ( present(tchkpt_dir) ) tchkpt_dir = infodata%tchkpt_dir + if ( present(aqua_planet) ) aqua_planet = infodata%aqua_planet + if ( present(aqua_planet_sst)) aqua_planet_sst= infodata%aqua_planet_sst + if ( present(run_barriers) ) run_barriers = infodata%run_barriers + if ( present(brnch_retain_casename) ) brnch_retain_casename = infodata%brnch_retain_casename + if ( present(read_restart) ) read_restart = infodata%read_restart + if ( present(single_column) ) single_column = infodata%single_column + if ( present(scmlat) ) scmlat = infodata%scmlat + if ( present(scmlon) ) scmlon = infodata%scmlon + if ( present(logFilePostFix) ) logFilePostFix = infodata%logFilePostFix + if ( present(outPathRoot) ) outPathRoot = infodata%outPathRoot + if ( present(perpetual) ) perpetual = infodata%perpetual + if ( present(perpetual_ymd) ) perpetual_ymd = infodata%perpetual_ymd + if ( present(orb_iyear) ) orb_iyear = infodata%orb_iyear + if ( present(orb_iyear_align)) orb_iyear_align= infodata%orb_iyear_align + if ( present(orb_mode) ) orb_mode = infodata%orb_mode + if ( present(orb_eccen) ) orb_eccen = infodata%orb_eccen + if ( present(orb_obliqr) ) orb_obliqr = infodata%orb_obliqr + if ( present(orb_obliq) ) orb_obliq = infodata%orb_obliq + if ( present(orb_lambm0) ) orb_lambm0 = infodata%orb_lambm0 + if ( present(orb_mvelpp) ) orb_mvelpp = infodata%orb_mvelpp + if ( present(orb_mvelp) ) orb_mvelp = infodata%orb_mvelp + if ( present(tfreeze_option) ) tfreeze_option = infodata%tfreeze_option + if ( present(flux_epbal) ) flux_epbal = infodata%flux_epbal + if ( present(flux_albav) ) flux_albav = infodata%flux_albav + if ( present(flux_diurnal) ) flux_diurnal = infodata%flux_diurnal + if ( present(gust_fac) ) gust_fac = infodata%gust_fac + if ( present(glc_renormalize_smb)) glc_renormalize_smb = infodata%glc_renormalize_smb + if ( present(wall_time_limit)) wall_time_limit= infodata%wall_time_limit + if ( present(cpl_decomp) ) cpl_decomp = infodata%cpl_decomp + if ( present(cpl_seq_option) ) cpl_seq_option = infodata%cpl_seq_option + if ( present(cpl_cdf64) ) cpl_cdf64 = infodata%cpl_cdf64 + if ( present(drv_threading) ) drv_threading = infodata%drv_threading + + if ( present(info_debug) ) info_debug = infodata%info_debug + if ( present(bfbflag) ) bfbflag = infodata%bfbflag + if ( present(dead_comps) ) dead_comps = infodata%dead_comps + + if ( present(atm_present) ) atm_present = infodata%atm_present + if ( present(atm_prognostic) ) atm_prognostic = infodata%atm_prognostic + if ( present(lnd_present) ) lnd_present = infodata%lnd_present + if ( present(lnd_prognostic) ) lnd_prognostic = infodata%lnd_prognostic + if ( present(rof_present) ) rof_present = infodata%rof_present + if ( present(rofice_present) ) rofice_present = infodata%rofice_present + if ( present(rof_prognostic) ) rof_prognostic = infodata%rof_prognostic + if ( present(flood_present) ) flood_present = infodata%flood_present + if ( present(ocn_present) ) ocn_present = infodata%ocn_present + if ( present(ocn_prognostic) ) ocn_prognostic = infodata%ocn_prognostic + if ( present(ocnrof_prognostic) ) ocnrof_prognostic = infodata%ocnrof_prognostic + if ( present(ice_present) ) ice_present = infodata%ice_present + if ( present(ice_prognostic) ) ice_prognostic = infodata%ice_prognostic + if ( present(iceberg_prognostic)) iceberg_prognostic = infodata%iceberg_prognostic + if ( present(glc_present) ) glc_present = infodata%glc_present + if ( present(glclnd_present) ) glclnd_present = infodata%glclnd_present + if ( present(glcocn_present) ) glcocn_present = infodata%glcocn_present + if ( present(glcice_present) ) glcice_present = infodata%glcice_present + if ( present(glc_prognostic) ) glc_prognostic = infodata%glc_prognostic + if ( present(glc_coupled_fluxes)) glc_coupled_fluxes = infodata%glc_coupled_fluxes + if ( present(wav_present) ) wav_present = infodata%wav_present + if ( present(wav_prognostic) ) wav_prognostic = infodata%wav_prognostic + if ( present(esp_present) ) esp_present = infodata%esp_present + if ( present(esp_prognostic) ) esp_prognostic = infodata%esp_prognostic + if ( present(atm_nx) ) atm_nx = infodata%atm_nx + if ( present(atm_ny) ) atm_ny = infodata%atm_ny + if ( present(lnd_nx) ) lnd_nx = infodata%lnd_nx + if ( present(lnd_ny) ) lnd_ny = infodata%lnd_ny + if ( present(rof_nx) ) rof_nx = infodata%rof_nx + if ( present(rof_ny) ) rof_ny = infodata%rof_ny + if ( present(ice_nx) ) ice_nx = infodata%ice_nx + if ( present(ice_ny) ) ice_ny = infodata%ice_ny + if ( present(ocn_nx) ) ocn_nx = infodata%ocn_nx + if ( present(ocn_ny) ) ocn_ny = infodata%ocn_ny + if ( present(glc_nx) ) glc_nx = infodata%glc_nx + if ( present(glc_ny) ) glc_ny = infodata%glc_ny + if ( present(wav_nx) ) wav_nx = infodata%wav_nx + if ( present(wav_ny) ) wav_ny = infodata%wav_ny + + if ( present(nextsw_cday) ) nextsw_cday = infodata%nextsw_cday + if ( present(precip_fact) ) precip_fact = infodata%precip_fact + if ( present(flux_epbalfact) ) then + flux_epbalfact = 1.0_SHR_KIND_R8 + if (trim(infodata%flux_epbal) == 'ocn') then + flux_epbalfact = infodata%precip_fact + end if + if (flux_epbalfact <= 0.0_SHR_KIND_R8) then + if (loglevel > 0) write(logunit,'(2a,e16.6)') & + trim(subname),' WARNING: factor from ocn = ',flux_epbalfact + if (loglevel > 0) write(logunit,'(2a)') & + trim(subname),' WARNING: resetting flux_epbalfact to 1.0' + flux_epbalfact = 1.0_SHR_KIND_R8 + end if + endif + if ( present(atm_phase) ) atm_phase = infodata%atm_phase + if ( present(lnd_phase) ) lnd_phase = infodata%lnd_phase + if ( present(ice_phase) ) ice_phase = infodata%ice_phase + if ( present(ocn_phase) ) ocn_phase = infodata%ocn_phase + if ( present(glc_phase) ) glc_phase = infodata%glc_phase + if ( present(rof_phase) ) rof_phase = infodata%rof_phase + if ( present(wav_phase) ) wav_phase = infodata%wav_phase + if ( present(esp_phase) ) esp_phase = infodata%esp_phase + if ( present(atm_aero) ) atm_aero = infodata%atm_aero + if ( present(glc_g2lupdate) ) glc_g2lupdate = infodata%glc_g2lupdate + if ( present(atm_resume) ) then + if (associated(infodata%pause_resume)) then + atm_resume(:) = infodata%pause_resume%atm_resume(:) + else + atm_resume(:) = ' ' + end if + end if + if ( present(lnd_resume) ) then + if (associated(infodata%pause_resume)) then + lnd_resume(:) = infodata%pause_resume%lnd_resume(:) + else + lnd_resume(:) = ' ' + end if + end if + if ( present(ice_resume) ) then + if (associated(infodata%pause_resume)) then + ice_resume(:) = infodata%pause_resume%ice_resume(:) + else + ice_resume(:) = ' ' + end if + end if + if ( present(ocn_resume) ) then + if (associated(infodata%pause_resume)) then + ocn_resume(:) = infodata%pause_resume%ocn_resume(:) + else + ocn_resume(:) = ' ' + end if + end if + if ( present(glc_resume) ) then + if (associated(infodata%pause_resume)) then + glc_resume(:) = infodata%pause_resume%glc_resume(:) + else + glc_resume(:) = ' ' + end if + end if + if ( present(rof_resume) ) then + if (associated(infodata%pause_resume)) then + rof_resume(:) = infodata%pause_resume%rof_resume(:) + else + rof_resume(:) = ' ' + end if + end if + if ( present(wav_resume) ) then + if (associated(infodata%pause_resume)) then + wav_resume(:) = infodata%pause_resume%wav_resume(:) + else + wav_resume(:) = ' ' + end if + end if + if ( present(cpl_resume) ) then + if (associated(infodata%pause_resume)) then + cpl_resume = infodata%pause_resume%cpl_resume + else + cpl_resume = ' ' + end if + end if + if ( present(max_cplstep_time) ) max_cplstep_time = infodata%max_cplstep_time + if ( present(glc_valid_input)) glc_valid_input = infodata%glc_valid_input + + END SUBROUTINE seq_infodata_GetData_explicit + + !=============================================================================== + SUBROUTINE seq_infodata_PutData_explicit( infodata , & + cime_model , & + case_name , & + case_desc , & + timing_dir , & + model_version , & + username , & + hostname , & + rest_case_name , & + tchkpt_dir , & + start_type , & + perpetual , & + perpetual_ymd , & + aqua_planet , & + aqua_planet_sst , & + brnch_retain_casename , & + read_restart , & + single_column , & + scmlat , & + scmlon , & + logFilePostFix , & + outPathRoot , & + atm_present , & + atm_prognostic , & + lnd_present , & + lnd_prognostic , & + rof_prognostic , & + rof_present , & + ocn_present , & + ocn_prognostic , & + ocnrof_prognostic , & + ice_present , & + ice_prognostic , & + glc_present , & + glc_prognostic , & + glc_coupled_fluxes , & + flood_present , & + wav_present , & + wav_prognostic , & + rofice_present , & + glclnd_present , & + glcocn_present , & + glcice_present , & + iceberg_prognostic , & + esp_present , & + esp_prognostic , & + bfbflag , & + cpl_decomp , & + cpl_seq_option , & + info_debug , & + dead_comps , & + run_barriers , & + nextsw_cday , & + precip_fact , & + flux_epbal , & + flux_albav , & + glc_g2lupdate , & + atm_aero , & + wall_time_limit , & + drv_threading , & + flux_diurnal , & + gust_fac , & + cpl_cdf64 , & + orb_iyear , & + orb_iyear_align , & + orb_mode , & + orb_mvelp , & + orb_eccen , & + orb_obliqr , & + orb_obliq , & + orb_lambm0 , & + orb_mvelpp , & + tfreeze_option , & + glc_renormalize_smb , & + glc_phase , & + rof_phase , & + atm_phase , & + lnd_phase , & + ocn_phase , & + ice_phase , & + wav_phase , & + esp_phase , & + wav_nx , & + wav_ny , & + atm_nx , & + atm_ny , & + lnd_nx , & + lnd_ny , & + rof_nx , & + rof_ny , & + ice_nx , & + ice_ny , & + ocn_nx , & + ocn_ny , & + glc_nx , & + glc_ny , & + atm_resume , & + lnd_resume , & + ocn_resume , & + ice_resume , & + glc_resume , & + rof_resume , & + wav_resume , & + cpl_resume , & + glc_valid_input) + + implicit none + + ! !DESCRIPTION: Put values into the infodata object. + + ! !INPUT/OUTPUT PARAMETERS: + + type(seq_infodata_type), intent(INOUT) :: infodata ! Input CCSM structure + character(len=*), optional, intent(IN) :: cime_model ! CIME model (acme or cesm) + character(len=*), optional, intent(IN) :: start_type ! Start type + character(len=*), optional, intent(IN) :: case_name ! Short case identification + character(len=*), optional, intent(IN) :: case_desc ! Long case description + character(len=*), optional, intent(IN) :: model_version ! Model version + character(len=*), optional, intent(IN) :: username ! Username + character(len=*), optional, intent(IN) :: hostname ! Hostname + character(len=*), optional, intent(IN) :: rest_case_name ! restart casename + character(len=*), optional, intent(IN) :: timing_dir ! timing dir name + character(len=*), optional, intent(IN) :: tchkpt_dir ! timing checkpoint dir name + logical, optional, intent(IN) :: aqua_planet ! aqua_planet mode + integer(SHR_KIND_IN), optional, intent(IN) :: aqua_planet_sst ! aqua_planet sst type + logical, optional, intent(IN) :: run_barriers ! barrier component run calls + logical, optional, intent(IN) :: brnch_retain_casename + logical, optional, intent(IN) :: read_restart ! read restart flag (only for data models) + logical, optional, intent(IN) :: single_column + real (SHR_KIND_R8), optional, intent(IN) :: scmlat + real (SHR_KIND_R8), optional, intent(IN) :: scmlon + character(len=*), optional, intent(IN) :: logFilePostFix ! output log file postfix + character(len=*), optional, intent(IN) :: outPathRoot ! output file root + logical, optional, intent(IN) :: perpetual ! If this is perpetual + integer, optional, intent(IN) :: perpetual_ymd ! If perpetual, date + character(len=*), optional, intent(IN) :: orb_mode ! orbital mode + integer, optional, intent(IN) :: orb_iyear ! orbital year + integer, optional, intent(IN) :: orb_iyear_align ! orbital year model year align + real(SHR_KIND_R8), optional, intent(IN) :: orb_eccen ! See shr_orb_mod + real(SHR_KIND_R8), optional, intent(IN) :: orb_obliqr ! See shr_orb_mod + real(SHR_KIND_R8), optional, intent(IN) :: orb_obliq ! See shr_orb_mod + real(SHR_KIND_R8), optional, intent(IN) :: orb_lambm0 ! See shr_orb_mod + real(SHR_KIND_R8), optional, intent(IN) :: orb_mvelpp ! See shr_orb_mod + real(SHR_KIND_R8), optional, intent(IN) :: orb_mvelp ! See shr_orb_mod + character(len=*), optional, intent(IN) :: tfreeze_option ! Freezing point of salt water + character(len=*), optional, intent(IN) :: flux_epbal ! selects E,P,R adjustment technique + logical, optional, intent(IN) :: flux_albav ! T => no diurnal cycle in ocn albedos + logical, optional, intent(IN) :: flux_diurnal ! T => diurnal cycle in atm/ocn flux + real(SHR_KIND_R8), optional, intent(IN) :: gust_fac ! wind gustiness factor + character(len=*), optional, intent(IN) :: glc_renormalize_smb ! Whether to renormalize smb sent from lnd -> glc + real(SHR_KIND_R8), optional, intent(IN) :: wall_time_limit ! force stop wall time (hours) + integer, optional, intent(IN) :: cpl_decomp ! coupler decomp + character(len=*), optional, intent(IN) :: cpl_seq_option ! coupler sequencing option + logical, optional, intent(IN) :: cpl_cdf64 ! netcdf large file setting + logical, optional, intent(IN) :: drv_threading ! driver threading control flag + + integer(SHR_KIND_IN), optional, intent(IN) :: info_debug + logical, optional, intent(IN) :: bfbflag + logical, optional, intent(IN) :: dead_comps ! do we have dead models + + logical, optional, intent(IN) :: atm_present ! provide data + logical, optional, intent(IN) :: atm_prognostic ! need data + logical, optional, intent(IN) :: lnd_present + logical, optional, intent(IN) :: lnd_prognostic + logical, optional, intent(IN) :: rof_present + logical, optional, intent(IN) :: rofice_present + logical, optional, intent(IN) :: rof_prognostic + logical, optional, intent(IN) :: flood_present + logical, optional, intent(IN) :: ocn_present + logical, optional, intent(IN) :: ocn_prognostic + logical, optional, intent(IN) :: ocnrof_prognostic + logical, optional, intent(IN) :: ice_present + logical, optional, intent(IN) :: ice_prognostic + logical, optional, intent(IN) :: iceberg_prognostic + logical, optional, intent(IN) :: glc_present + logical, optional, intent(IN) :: glclnd_present + logical, optional, intent(IN) :: glcocn_present + logical, optional, intent(IN) :: glcice_present + logical, optional, intent(IN) :: glc_prognostic + logical, optional, intent(IN) :: glc_coupled_fluxes + logical, optional, intent(IN) :: wav_present + logical, optional, intent(IN) :: wav_prognostic + logical, optional, intent(IN) :: esp_present + logical, optional, intent(IN) :: esp_prognostic + integer(SHR_KIND_IN), optional, intent(IN) :: atm_nx ! nx,ny 2d grid size global + integer(SHR_KIND_IN), optional, intent(IN) :: atm_ny ! nx,ny 2d grid size global + integer(SHR_KIND_IN), optional, intent(IN) :: lnd_nx + integer(SHR_KIND_IN), optional, intent(IN) :: lnd_ny + integer(SHR_KIND_IN), optional, intent(IN) :: rof_nx + integer(SHR_KIND_IN), optional, intent(IN) :: rof_ny + integer(SHR_KIND_IN), optional, intent(IN) :: ice_nx + integer(SHR_KIND_IN), optional, intent(IN) :: ice_ny + integer(SHR_KIND_IN), optional, intent(IN) :: ocn_nx + integer(SHR_KIND_IN), optional, intent(IN) :: ocn_ny + integer(SHR_KIND_IN), optional, intent(IN) :: glc_nx + integer(SHR_KIND_IN), optional, intent(IN) :: glc_ny + integer(SHR_KIND_IN), optional, intent(IN) :: wav_nx + integer(SHR_KIND_IN), optional, intent(IN) :: wav_ny + real(SHR_KIND_R8), optional, intent(IN) :: nextsw_cday ! calendar of next atm shortwave + real(SHR_KIND_R8), optional, intent(IN) :: precip_fact ! precip factor + integer(SHR_KIND_IN), optional, intent(IN) :: atm_phase ! atm phase + integer(SHR_KIND_IN), optional, intent(IN) :: lnd_phase ! lnd phase + integer(SHR_KIND_IN), optional, intent(IN) :: ice_phase ! ice phase + integer(SHR_KIND_IN), optional, intent(IN) :: ocn_phase ! ocn phase + integer(SHR_KIND_IN), optional, intent(IN) :: glc_phase ! glc phase + integer(SHR_KIND_IN), optional, intent(IN) :: rof_phase ! rof phase + integer(SHR_KIND_IN), optional, intent(IN) :: wav_phase ! wav phase + integer(SHR_KIND_IN), optional, intent(IN) :: esp_phase ! esp phase + logical, optional, intent(IN) :: atm_aero ! atm aerosols + logical, optional, intent(IN) :: glc_g2lupdate ! update glc2lnd fields in lnd model + logical, optional, intent(IN) :: glc_valid_input + character(SHR_KIND_CL), optional, intent(IN) :: atm_resume(:) ! atm resume + character(SHR_KIND_CL), optional, intent(IN) :: lnd_resume(:) ! lnd resume + character(SHR_KIND_CL), optional, intent(IN) :: ice_resume(:) ! ice resume + character(SHR_KIND_CL), optional, intent(IN) :: ocn_resume(:) ! ocn resume + character(SHR_KIND_CL), optional, intent(IN) :: glc_resume(:) ! glc resume + character(SHR_KIND_CL), optional, intent(IN) :: rof_resume(:) ! rof resume + character(SHR_KIND_CL), optional, intent(IN) :: wav_resume(:) ! wav resume + character(SHR_KIND_CL), optional, intent(IN) :: cpl_resume ! cpl resume + + !----- local ----- + character(len=*), parameter :: subname = '(seq_infodata_PutData_explicit) ' + !------------------------------------------------------------------------------- + + if ( present(cime_model) ) infodata%cime_model = cime_model + if ( present(start_type) ) infodata%start_type = start_type + if ( present(case_name) ) infodata%case_name = case_name + if ( present(case_desc) ) infodata%case_desc = case_desc + if ( present(model_version) ) infodata%model_version = model_version + if ( present(username) ) infodata%username = username + if ( present(hostname) ) infodata%hostname = hostname + if ( present(rest_case_name) ) infodata%rest_case_name = rest_case_name + if ( present(timing_dir) ) infodata%timing_dir = timing_dir + if ( present(tchkpt_dir) ) infodata%tchkpt_dir = tchkpt_dir + if ( present(aqua_planet) ) infodata%aqua_planet = aqua_planet + if ( present(aqua_planet_sst) ) infodata%aqua_planet_sst= aqua_planet_sst + if ( present(run_barriers) ) infodata%run_barriers = run_barriers + if ( present(brnch_retain_casename) ) infodata%brnch_retain_casename = brnch_retain_casename + if ( present(read_restart) ) infodata%read_restart = read_restart + if ( present(single_column) ) infodata%single_column = single_column + if ( present(scmlat) ) infodata%scmlat = scmlat + if ( present(scmlon) ) infodata%scmlon = scmlon + if ( present(logFilePostFix) ) infodata%logFilePostFix = logFilePostFix + if ( present(outPathRoot) ) infodata%outPathRoot = outPathRoot + if ( present(perpetual) ) infodata%perpetual = perpetual + if ( present(perpetual_ymd) ) infodata%perpetual_ymd = perpetual_ymd + if ( present(orb_iyear) ) infodata%orb_iyear = orb_iyear + if ( present(orb_iyear_align) ) infodata%orb_iyear_align= orb_iyear_align + if ( present(orb_mode) ) infodata%orb_mode = orb_mode + if ( present(orb_eccen) ) infodata%orb_eccen = orb_eccen + if ( present(orb_obliqr) ) infodata%orb_obliqr = orb_obliqr + if ( present(orb_obliq) ) infodata%orb_obliq = orb_obliq + if ( present(orb_lambm0) ) infodata%orb_lambm0 = orb_lambm0 + if ( present(orb_mvelpp) ) infodata%orb_mvelpp = orb_mvelpp + if ( present(orb_mvelp) ) infodata%orb_mvelp = orb_mvelp + if ( present(tfreeze_option) ) infodata%tfreeze_option = tfreeze_option + if ( present(flux_epbal) ) infodata%flux_epbal = flux_epbal + if ( present(flux_albav) ) infodata%flux_albav = flux_albav + if ( present(flux_diurnal) ) infodata%flux_diurnal = flux_diurnal + if ( present(gust_fac) ) infodata%gust_fac = gust_fac + if ( present(glc_renormalize_smb) ) infodata%glc_renormalize_smb = glc_renormalize_smb + if ( present(wall_time_limit) ) infodata%wall_time_limit= wall_time_limit + if ( present(cpl_decomp) ) infodata%cpl_decomp = cpl_decomp + if ( present(cpl_seq_option) ) infodata%cpl_seq_option = cpl_seq_option + if ( present(cpl_cdf64) ) infodata%cpl_cdf64 = cpl_cdf64 + if ( present(drv_threading) ) infodata%drv_threading = drv_threading + + if ( present(info_debug) ) infodata%info_debug = info_debug + if ( present(bfbflag) ) infodata%bfbflag = bfbflag + if ( present(dead_comps) ) infodata%dead_comps = dead_comps + + if ( present(atm_present) ) infodata%atm_present = atm_present + if ( present(atm_prognostic) ) infodata%atm_prognostic = atm_prognostic + if ( present(lnd_present) ) infodata%lnd_present = lnd_present + if ( present(lnd_prognostic) ) infodata%lnd_prognostic = lnd_prognostic + if ( present(rof_present) ) infodata%rof_present = rof_present + if ( present(rofice_present) ) infodata%rofice_present = rofice_present + if ( present(rof_prognostic) ) infodata%rof_prognostic = rof_prognostic + if ( present(flood_present) ) infodata%flood_present = flood_present + if ( present(ocn_present) ) infodata%ocn_present = ocn_present + if ( present(ocn_prognostic) ) infodata%ocn_prognostic = ocn_prognostic + if ( present(ocnrof_prognostic) ) infodata%ocnrof_prognostic = ocnrof_prognostic + if ( present(ice_present) ) infodata%ice_present = ice_present + if ( present(ice_prognostic) ) infodata%ice_prognostic = ice_prognostic + if ( present(iceberg_prognostic) ) infodata%iceberg_prognostic = iceberg_prognostic + if ( present(glc_present) ) infodata%glc_present = glc_present + if ( present(glclnd_present) ) infodata%glclnd_present = glclnd_present + if ( present(glcocn_present) ) infodata%glcocn_present = glcocn_present + if ( present(glcice_present) ) infodata%glcice_present = glcice_present + if ( present(glc_prognostic) ) infodata%glc_prognostic = glc_prognostic + if ( present(glc_coupled_fluxes) ) infodata%glc_coupled_fluxes = glc_coupled_fluxes + if ( present(wav_present) ) infodata%wav_present = wav_present + if ( present(wav_prognostic) ) infodata%wav_prognostic = wav_prognostic + if ( present(esp_present) ) infodata%esp_present = esp_present + if ( present(esp_prognostic) ) infodata%esp_prognostic = esp_prognostic + if ( present(atm_nx) ) infodata%atm_nx = atm_nx + if ( present(atm_ny) ) infodata%atm_ny = atm_ny + if ( present(lnd_nx) ) infodata%lnd_nx = lnd_nx + if ( present(lnd_ny) ) infodata%lnd_ny = lnd_ny + if ( present(rof_nx) ) infodata%rof_nx = rof_nx + if ( present(rof_ny) ) infodata%rof_ny = rof_ny + if ( present(ice_nx) ) infodata%ice_nx = ice_nx + if ( present(ice_ny) ) infodata%ice_ny = ice_ny + if ( present(ocn_nx) ) infodata%ocn_nx = ocn_nx + if ( present(ocn_ny) ) infodata%ocn_ny = ocn_ny + if ( present(glc_nx) ) infodata%glc_nx = glc_nx + if ( present(glc_ny) ) infodata%glc_ny = glc_ny + if ( present(wav_nx) ) infodata%wav_nx = wav_nx + if ( present(wav_ny) ) infodata%wav_ny = wav_ny + + if ( present(nextsw_cday) ) infodata%nextsw_cday = nextsw_cday + if ( present(precip_fact) ) infodata%precip_fact = precip_fact + if ( present(atm_phase) ) infodata%atm_phase = atm_phase + if ( present(lnd_phase) ) infodata%lnd_phase = lnd_phase + if ( present(ice_phase) ) infodata%ice_phase = ice_phase + if ( present(ocn_phase) ) infodata%ocn_phase = ocn_phase + if ( present(glc_phase) ) infodata%glc_phase = glc_phase + if ( present(rof_phase) ) infodata%rof_phase = rof_phase + if ( present(wav_phase) ) infodata%wav_phase = wav_phase + if ( present(esp_phase) ) infodata%esp_phase = esp_phase + if ( present(atm_aero) ) infodata%atm_aero = atm_aero + if ( present(glc_g2lupdate) ) infodata%glc_g2lupdate = glc_g2lupdate + if ( present(glc_valid_input) ) infodata%glc_valid_input = glc_valid_input + + if ( present(atm_resume) ) then + if (associated(infodata%pause_resume)) then + infodata%pause_resume%atm_resume(:) = atm_resume(:) + else if (ANY(len_trim(atm_resume(:)) > 0)) then + allocate(infodata%pause_resume) + infodata%pause_resume%atm_resume(:) = atm_resume(:) + end if + end if + if ( present(lnd_resume) ) then + if (associated(infodata%pause_resume)) then + infodata%pause_resume%lnd_resume(:) = lnd_resume(:) + else if (ANY(len_trim(lnd_resume(:)) > 0)) then + allocate(infodata%pause_resume) + infodata%pause_resume%lnd_resume(:) = lnd_resume(:) + end if + end if + if ( present(ice_resume) ) then + if (associated(infodata%pause_resume)) then + infodata%pause_resume%ice_resume(:) = ice_resume(:) + else if (ANY(len_trim(ice_resume(:)) > 0)) then + allocate(infodata%pause_resume) + infodata%pause_resume%ice_resume(:) = ice_resume(:) + end if + end if + if ( present(ocn_resume) ) then + if (associated(infodata%pause_resume)) then + infodata%pause_resume%ocn_resume(:) = ocn_resume(:) + else if (ANY(len_trim(ocn_resume(:)) > 0)) then + allocate(infodata%pause_resume) + infodata%pause_resume%ocn_resume(:) = ocn_resume(:) + end if + end if + if ( present(glc_resume) ) then + if (associated(infodata%pause_resume)) then + infodata%pause_resume%glc_resume(:) = glc_resume(:) + else if (ANY(len_trim(glc_resume(:)) > 0)) then + allocate(infodata%pause_resume) + infodata%pause_resume%glc_resume(:) = glc_resume(:) + end if + end if + if ( present(rof_resume) ) then + if (associated(infodata%pause_resume)) then + infodata%pause_resume%rof_resume(:) = rof_resume(:) + else if (ANY(len_trim(rof_resume(:)) > 0)) then + allocate(infodata%pause_resume) + infodata%pause_resume%rof_resume(:) = rof_resume(:) + end if + end if + if ( present(wav_resume) ) then + if (associated(infodata%pause_resume)) then + infodata%pause_resume%wav_resume(:) = wav_resume(:) + else if (ANY(len_trim(wav_resume(:)) > 0)) then + allocate(infodata%pause_resume) + infodata%pause_resume%wav_resume(:) = wav_resume(:) + end if + end if + if ( present(cpl_resume) ) then + if (associated(infodata%pause_resume)) then + infodata%pause_resume%cpl_resume = cpl_resume + else if (len_trim(cpl_resume) > 0) then + allocate(infodata%pause_resume) + infodata%pause_resume%cpl_resume = cpl_resume + end if + end if + + END SUBROUTINE seq_infodata_PutData_explicit + + !=============================================================================== + subroutine seq_infodata_pauseresume_bcast(infodata, mpicom, pebcast) + + use shr_mpi_mod, only : shr_mpi_bcast + + ! !DESCRIPTION: + ! Broadcast the pause_resume data from an infodata across pes of mpicom + + ! !INPUT/OUTPUT PARAMETERS: + + type(seq_infodata_type), intent(INOUT) :: infodata ! assume valid on root pe + integer(SHR_KIND_IN), intent(IN) :: mpicom ! MPI Communicator + integer(SHR_KIND_IN), optional, intent(IN) :: pebcast ! pe sending + + !----- local ----- + integer :: ind + integer(SHR_KIND_IN) :: pebcast_local + character(len=*), parameter :: subname = '(seq_infodata_pauseresume_bcast) ' + + if (present(pebcast)) then + pebcast_local = pebcast + else + pebcast_local = 0 + end if + + if (associated(infodata%pause_resume)) then + do ind = 1, num_inst_atm + call shr_mpi_bcast(infodata%pause_resume%atm_resume(ind), mpicom, & + pebcast=pebcast_local) + end do + do ind = 1, num_inst_lnd + call shr_mpi_bcast(infodata%pause_resume%lnd_resume(ind), mpicom, & + pebcast=pebcast_local) + end do + do ind = 1, num_inst_ice + call shr_mpi_bcast(infodata%pause_resume%ice_resume(ind), mpicom, & + pebcast=pebcast_local) + end do + do ind = 1, num_inst_ocn + call shr_mpi_bcast(infodata%pause_resume%ocn_resume(ind), mpicom, & + pebcast=pebcast_local) + end do + do ind = 1, num_inst_glc + call shr_mpi_bcast(infodata%pause_resume%glc_resume(ind), mpicom, & + pebcast=pebcast_local) + end do + do ind = 1, num_inst_rof + call shr_mpi_bcast(infodata%pause_resume%rof_resume(ind), mpicom, & + pebcast=pebcast_local) + end do + do ind = 1, num_inst_wav + call shr_mpi_bcast(infodata%pause_resume%wav_resume(ind), mpicom, & + pebcast=pebcast_local) + end do + call shr_mpi_bcast(infodata%pause_resume%cpl_resume, mpicom, & + pebcast=pebcast_local) + end if + end subroutine seq_infodata_pauseresume_bcast + + !=============================================================================== + subroutine seq_infodata_bcast(infodata,mpicom) + + use shr_mpi_mod, only : shr_mpi_bcast + + implicit none + + ! !DESCRIPTION: + ! Broadcast an infodata across pes of mpicom + + ! !INPUT/OUTPUT PARAMETERS: + + type(seq_infodata_type), intent(INOUT) :: infodata ! assume valid on root pe + integer(SHR_KIND_IN), intent(IN) :: mpicom ! mpi comm + !------------------------------------------------------------------------------- + + call shr_mpi_bcast(infodata%cime_model, mpicom) + call shr_mpi_bcast(infodata%start_type, mpicom) + call shr_mpi_bcast(infodata%case_desc, mpicom) + call shr_mpi_bcast(infodata%model_version, mpicom) + call shr_mpi_bcast(infodata%username, mpicom) + call shr_mpi_bcast(infodata%hostname, mpicom) + call shr_mpi_bcast(infodata%case_name, mpicom) + call shr_mpi_bcast(infodata%timing_dir, mpicom) + call shr_mpi_bcast(infodata%tchkpt_dir, mpicom) + call shr_mpi_bcast(infodata%aqua_planet, mpicom) + call shr_mpi_bcast(infodata%aqua_planet_sst, mpicom) + call shr_mpi_bcast(infodata%run_barriers, mpicom) + call shr_mpi_bcast(infodata%brnch_retain_casename, mpicom) + call shr_mpi_bcast(infodata%read_restart, mpicom) + call shr_mpi_bcast(infodata%single_column, mpicom) + call shr_mpi_bcast(infodata%scmlat, mpicom) + call shr_mpi_bcast(infodata%scmlon, mpicom) + call shr_mpi_bcast(infodata%logFilePostFix, mpicom) + call shr_mpi_bcast(infodata%outPathRoot, mpicom) + call shr_mpi_bcast(infodata%perpetual, mpicom) + call shr_mpi_bcast(infodata%perpetual_ymd, mpicom) + call shr_mpi_bcast(infodata%orb_iyear, mpicom) + call shr_mpi_bcast(infodata%orb_iyear_align, mpicom) + call shr_mpi_bcast(infodata%orb_mode, mpicom) + call shr_mpi_bcast(infodata%orb_eccen, mpicom) + call shr_mpi_bcast(infodata%orb_obliq, mpicom) + call shr_mpi_bcast(infodata%orb_mvelp, mpicom) + call shr_mpi_bcast(infodata%orb_obliqr, mpicom) + call shr_mpi_bcast(infodata%orb_lambm0, mpicom) + call shr_mpi_bcast(infodata%orb_mvelpp, mpicom) + call shr_mpi_bcast(infodata%tfreeze_option, mpicom) + call shr_mpi_bcast(infodata%flux_epbal, mpicom) + call shr_mpi_bcast(infodata%flux_albav, mpicom) + call shr_mpi_bcast(infodata%flux_diurnal, mpicom) + call shr_mpi_bcast(infodata%gust_fac, mpicom) + call shr_mpi_bcast(infodata%glc_renormalize_smb, mpicom) + call shr_mpi_bcast(infodata%wall_time_limit, mpicom) + call shr_mpi_bcast(infodata%cpl_decomp, mpicom) + call shr_mpi_bcast(infodata%cpl_seq_option, mpicom) + call shr_mpi_bcast(infodata%cpl_cdf64, mpicom) + call shr_mpi_bcast(infodata%drv_threading, mpicom) + call shr_mpi_bcast(infodata%info_debug, mpicom) + call shr_mpi_bcast(infodata%bfbflag, mpicom) + call shr_mpi_bcast(infodata%dead_comps, mpicom) + + call shr_mpi_bcast(infodata%atm_present, mpicom) + call shr_mpi_bcast(infodata%atm_prognostic, mpicom) + call shr_mpi_bcast(infodata%lnd_present, mpicom) + call shr_mpi_bcast(infodata%lnd_prognostic, mpicom) + call shr_mpi_bcast(infodata%rof_present, mpicom) + call shr_mpi_bcast(infodata%rofice_present, mpicom) + call shr_mpi_bcast(infodata%rof_prognostic, mpicom) + call shr_mpi_bcast(infodata%flood_present, mpicom) + call shr_mpi_bcast(infodata%ocn_present, mpicom) + + call shr_mpi_bcast(infodata%ocn_prognostic, mpicom) + call shr_mpi_bcast(infodata%ocnrof_prognostic, mpicom) + call shr_mpi_bcast(infodata%ice_present, mpicom) + call shr_mpi_bcast(infodata%ice_prognostic, mpicom) + call shr_mpi_bcast(infodata%iceberg_prognostic, mpicom) + call shr_mpi_bcast(infodata%glc_present, mpicom) + call shr_mpi_bcast(infodata%glclnd_present, mpicom) + call shr_mpi_bcast(infodata%glcocn_present, mpicom) + call shr_mpi_bcast(infodata%glcice_present, mpicom) + call shr_mpi_bcast(infodata%glc_prognostic, mpicom) + call shr_mpi_bcast(infodata%glc_coupled_fluxes, mpicom) + call shr_mpi_bcast(infodata%wav_present, mpicom) + call shr_mpi_bcast(infodata%wav_prognostic, mpicom) + call shr_mpi_bcast(infodata%esp_present, mpicom) + call shr_mpi_bcast(infodata%esp_prognostic, mpicom) + + call shr_mpi_bcast(infodata%atm_nx, mpicom) + call shr_mpi_bcast(infodata%atm_ny, mpicom) + call shr_mpi_bcast(infodata%lnd_nx, mpicom) + call shr_mpi_bcast(infodata%lnd_ny, mpicom) + call shr_mpi_bcast(infodata%rof_nx, mpicom) + call shr_mpi_bcast(infodata%rof_ny, mpicom) + call shr_mpi_bcast(infodata%ice_nx, mpicom) + call shr_mpi_bcast(infodata%ice_ny, mpicom) + call shr_mpi_bcast(infodata%ocn_nx, mpicom) + call shr_mpi_bcast(infodata%ocn_ny, mpicom) + call shr_mpi_bcast(infodata%glc_nx, mpicom) + call shr_mpi_bcast(infodata%glc_ny, mpicom) + call shr_mpi_bcast(infodata%wav_nx, mpicom) + call shr_mpi_bcast(infodata%wav_ny, mpicom) + + call shr_mpi_bcast(infodata%nextsw_cday, mpicom) + call shr_mpi_bcast(infodata%precip_fact, mpicom) + + call shr_mpi_bcast(infodata%atm_phase, mpicom) + call shr_mpi_bcast(infodata%lnd_phase, mpicom) + call shr_mpi_bcast(infodata%ice_phase, mpicom) + call shr_mpi_bcast(infodata%ocn_phase, mpicom) + call shr_mpi_bcast(infodata%glc_phase, mpicom) + call shr_mpi_bcast(infodata%rof_phase, mpicom) + call shr_mpi_bcast(infodata%wav_phase, mpicom) + + call shr_mpi_bcast(infodata%atm_aero, mpicom) + call shr_mpi_bcast(infodata%glc_g2lupdate, mpicom) + call shr_mpi_bcast(infodata%glc_valid_input, mpicom) + + call seq_infodata_pauseresume_bcast(infodata, mpicom) + + end subroutine seq_infodata_bcast + +END MODULE seq_infodata_mod diff --git a/src/drivers/nuopc/shr/seq_timemgr_mod.F90 b/src/drivers/nuopc/shr/seq_timemgr_mod.F90 new file mode 100644 index 00000000000..c3f17b1c5d1 --- /dev/null +++ b/src/drivers/nuopc/shr/seq_timemgr_mod.F90 @@ -0,0 +1,2573 @@ +!=============================================================================== +! +! !MODULE: seq_timemgr_mod --- Time-manager module +! +! !DESCRIPTION: +! +! A module to create derived types to manage time and clock information +! for use with CCSM drivers and models. +! +! !REMARKS: +! +! !REVISION HISTORY: +! 2005-Nov-11 - E. Kluzek - creation as eshr_timemgr_mod +! 2007-Sep-12 - T. Craig - extended +! 2007-Oct-05 - T. Craig - refactored to support concurrent models +! 2007-Nov-15 - T. Craig - refactored for ccsm4 and renamed seq_timemgr_mod +! +! !INTERFACE: ------------------------------------------------------------------ + +module seq_timemgr_mod + +! !USES: + use ESMF + use shr_cal_mod + use SHR_KIND_mod, only: SHR_KIND_IN, SHR_KIND_R8, SHR_KIND_CS, & + SHR_KIND_CL, SHR_KIND_I8 + use seq_comm_mct, only: logunit, loglevel, seq_comm_iamin, CPLID, & + seq_comm_gloroot, seq_comm_iamroot + use shr_sys_mod, only: shr_sys_abort, shr_sys_flush + + implicit none + + private ! default private + +! ! PUBLIC TYPES: + + public :: seq_timemgr_type ! Wrapped clock object + +! ! PUBLIC MEMBER FUNCTIONS: + + ! --- Clock object methods -------------------------------------------------- + public :: seq_timemgr_clockInit ! Setup the sync clock + public :: seq_timemgr_clockAdvance ! Advance the sync clock + public :: seq_timemgr_clockPrint ! Print sync clock information + + public :: seq_timemgr_EClockGetData ! Get data from an ESMF clock + + public :: seq_timemgr_EClockDateInSync ! compare EClock to ymd/tod + public :: seq_timemgr_alarmSetOn ! Turn an alarm on + public :: seq_timemgr_alarmSetOff ! Turn an alarm off + public :: seq_timemgr_alarmIsOn ! Is an alarm ringing + public :: seq_timemgr_ETimeInit ! Create ESMF_Time object + public :: seq_timemgr_ETimeGet ! Query ESMF_Time object + + ! --- For usability, built on interfaces above --- + public :: seq_timemgr_restartAlarmIsOn ! Is a restart alarm ringing + public :: seq_timemgr_stopAlarmIsOn ! Is a stop alarm ringing + public :: seq_timemgr_historyAlarmIsOn ! Is a history alarm ringing + public :: seq_timemgr_pauseAlarmIsOn ! Is a pause alarm ringing + ! --- ESP components need to know about the state of other components + public :: seq_timemgr_pause_active ! Pause/resume is enabled + public :: seq_timemgr_pause_component_index ! Index of named component + public :: seq_timemgr_pause_component_active ! .true. is comp should pause + + ! ! PUBLIC PARAMETERS: + + integer(SHR_KIND_IN),public :: seq_timemgr_histavg_type + integer(SHR_KIND_IN),public,parameter :: seq_timemgr_type_other = -1 + integer(SHR_KIND_IN),public,parameter :: seq_timemgr_type_never = 1 + integer(SHR_KIND_IN),public,parameter :: seq_timemgr_type_nhour = 2 + integer(SHR_KIND_IN),public,parameter :: seq_timemgr_type_nday = 3 + integer(SHR_KIND_IN),public,parameter :: seq_timemgr_type_nmonth = 4 + integer(SHR_KIND_IN),public,parameter :: seq_timemgr_type_nyear = 5 + + character(SHR_KIND_CL),public,parameter :: seq_timemgr_noleap = shr_cal_noleap + character(SHR_KIND_CL),public,parameter :: seq_timemgr_gregorian = shr_cal_gregorian + +! These are public but declared in the private area for clarity + +! clocknames: +! character(len=*),public,parameter :: & +! seq_timemgr_clock_drv +! seq_timemgr_clock_atm +! seq_timemgr_clock_lnd +! seq_timemgr_clock_rof +! seq_timemgr_clock_ocn +! seq_timemgr_clock_ice +! seq_timemgr_clock_glc +! seq_timemgr_clock_wav +! seq_timemgr_clock_esp + +! alarmnames: +! character(len=*),public,parameter :: & +! seq_timemgr_alarm_restart +! seq_timemgr_alarm_run +! seq_timemgr_alarm_stop +! seq_timemgr_alarm_datestop +! seq_timemgr_alarm_history +! seq_timemgr_alarm_atmrun +! seq_timemgr_alarm_lndrun +! seq_timemgr_alarm_rofrun +! seq_timemgr_alarm_ocnrun +! seq_timemgr_alarm_icerun +! seq_timemgr_alarm_glcrun +! seq_timemgr_alarm_glcrun_avg +! seq_timemgr_alarm_wavrun +! seq_timemgr_alarm_esprun +! seq_timemgr_alarm_ocnnext +! seq_timemgr_alarm_tprof +! seq_timemgr_alarm_histavg +! seq_timemgr_alarm_pause +! seq_timemgr_alarm_barrier + + private:: seq_timemgr_alarmGet + private:: seq_timemgr_alarmInit + private:: seq_timemgr_EClockInit + private:: seq_timemgr_ESMFDebug + private:: seq_timemgr_ESMFCodeCheck + + character(len=*), private, parameter :: & + seq_timemgr_optNONE = "none" , & + seq_timemgr_optNever = "never" , & + seq_timemgr_optNSteps = "nsteps" , & + seq_timemgr_optNStep = "nstep" , & + seq_timemgr_optNSeconds = "nseconds" , & + seq_timemgr_optNSecond = "nsecond" , & + seq_timemgr_optNMinutes = "nminutes" , & + seq_timemgr_optNMinute = "nminute" , & + seq_timemgr_optNHours = "nhours" , & + seq_timemgr_optNHour = "nhour" , & + seq_timemgr_optNDays = "ndays" , & + seq_timemgr_optNDay = "nday" , & + seq_timemgr_optNMonths = "nmonths" , & + seq_timemgr_optNMonth = "nmonth" , & + seq_timemgr_optNYears = "nyears" , & + seq_timemgr_optNYear = "nyear" , & + seq_timemgr_optMonthly = "monthly" , & + seq_timemgr_optYearly = "yearly" , & + seq_timemgr_optDate = "date" , & + seq_timemgr_optIfdays0 = "ifdays0" , & + seq_timemgr_optEnd = "end" , & + seq_timemgr_optGLCCouplingPeriod = "glc_coupling_period" + + integer(SHR_KIND_IN),private,parameter :: & + seq_timemgr_nclock_drv = 1, & + seq_timemgr_nclock_atm = 2, & + seq_timemgr_nclock_lnd = 3, & + seq_timemgr_nclock_ocn = 4, & + seq_timemgr_nclock_ice = 5, & + seq_timemgr_nclock_glc = 6, & + seq_timemgr_nclock_wav = 7, & + seq_timemgr_nclock_rof = 8, & + seq_timemgr_nclock_esp = 9 + + integer(SHR_KIND_IN),private,parameter :: max_clocks = 9 + character(len=*),public,parameter :: & + seq_timemgr_clock_drv = 'seq_timemgr_clock_drv' , & + seq_timemgr_clock_atm = 'seq_timemgr_clock_atm' , & + seq_timemgr_clock_lnd = 'seq_timemgr_clock_lnd' , & + seq_timemgr_clock_ocn = 'seq_timemgr_clock_ocn' , & + seq_timemgr_clock_ice = 'seq_timemgr_clock_ice' , & + seq_timemgr_clock_glc = 'seq_timemgr_clock_glc' , & + seq_timemgr_clock_wav = 'seq_timemgr_clock_wav' , & + seq_timemgr_clock_rof = 'seq_timemgr_clock_rof' , & + seq_timemgr_clock_esp = 'seq_timemgr_clock_esp' + character(len=8),private,parameter :: seq_timemgr_clocks(max_clocks) = & + (/'drv ','atm ','lnd ','ocn ', & + 'ice ','glc ','wav ','rof ','esp '/) + + ! Alarms on both component clocks and driver clock + integer(SHR_KIND_IN),private,parameter :: & + seq_timemgr_nalarm_restart = 1 , & ! driver and component clock alarm + seq_timemgr_nalarm_run = 2 , & ! driver and component clock alarm + seq_timemgr_nalarm_stop = 3 , & ! driver and component clock alarm + seq_timemgr_nalarm_datestop = 4 , & ! driver and component clock alarm + seq_timemgr_nalarm_history = 5 , & ! driver and component clock alarm + seq_timemgr_nalarm_atmrun = 6 , & ! driver only clock alarm + seq_timemgr_nalarm_lndrun = 7 , & ! driver only clock alarm + seq_timemgr_nalarm_ocnrun = 8 , & ! driver only clock alarm + seq_timemgr_nalarm_icerun = 9 , & ! driver only clock alarm + seq_timemgr_nalarm_glcrun =10 , & ! driver only clock alarm + seq_timemgr_nalarm_glcrun_avg =11 , & ! driver only clock alarm + seq_timemgr_nalarm_ocnnext =12 , & ! driver only clock alarm + seq_timemgr_nalarm_tprof =13 , & ! driver and component clock alarm + seq_timemgr_nalarm_histavg =14 , & ! driver and component clock alarm + seq_timemgr_nalarm_rofrun =15 , & ! driver only clock alarm + seq_timemgr_nalarm_wavrun =16 , & ! driver only clock alarm + seq_timemgr_nalarm_esprun =17 , & ! driver only clock alarm + seq_timemgr_nalarm_pause =18 , & + seq_timemgr_nalarm_barrier =19 , & ! driver and component clock alarm + max_alarms = seq_timemgr_nalarm_barrier + + character(len=*),public,parameter :: & + seq_timemgr_alarm_restart = 'seq_timemgr_alarm_restart ', & + seq_timemgr_alarm_run = 'seq_timemgr_alarm_run ', & + seq_timemgr_alarm_stop = 'seq_timemgr_alarm_stop ', & + seq_timemgr_alarm_datestop = 'seq_timemgr_alarm_datestop', & + seq_timemgr_alarm_history = 'seq_timemgr_alarm_history ', & + seq_timemgr_alarm_atmrun = 'seq_timemgr_alarm_atmrun ', & + seq_timemgr_alarm_lndrun = 'seq_timemgr_alarm_lndrun ', & + seq_timemgr_alarm_ocnrun = 'seq_timemgr_alarm_ocnrun ', & + seq_timemgr_alarm_icerun = 'seq_timemgr_alarm_icerun ', & + seq_timemgr_alarm_glcrun = 'seq_timemgr_alarm_glcrun ', & + seq_timemgr_alarm_glcrun_avg = 'seq_timemgr_alarm_glcrun_avg' , & + seq_timemgr_alarm_ocnnext = 'seq_timemgr_alarm_ocnnext ', & + seq_timemgr_alarm_tprof = 'seq_timemgr_alarm_tprof ', & + seq_timemgr_alarm_histavg = 'seq_timemgr_alarm_histavg ', & + seq_timemgr_alarm_rofrun = 'seq_timemgr_alarm_rofrun ', & + seq_timemgr_alarm_wavrun = 'seq_timemgr_alarm_wavrun ', & + seq_timemgr_alarm_esprun = 'seq_timemgr_alarm_esprun ', & + seq_timemgr_alarm_pause = 'seq_timemgr_alarm_pause ', & + seq_timemgr_alarm_barrier = 'seq_timemgr_alarm_barrier ' + + ! Active pause - resume components + logical, private :: pause_active(max_clocks) = .false. + + type EClock_pointer ! needed for array of pointers + type(ESMF_Clock),pointer :: EClock => null() + end type EClock_pointer + + type seq_timemgr_type + private + type(EClock_pointer) :: ECP(max_clocks) ! ESMF clocks, array of pointers + type(ESMF_Alarm) :: EAlarm(max_clocks,max_alarms) ! array of clock alarms + end type seq_timemgr_type + + type (seq_timemgr_type),public :: seq_timemgr_SyncClock ! array of all clocks & alarm + type (ESMF_clock),public, target :: seq_timemgr_EClock_d ! driver clock + type (ESMF_clock),public, target :: seq_timemgr_EClock_a + type (ESMF_clock),public, target :: seq_timemgr_EClock_l + type (ESMF_clock),public, target :: seq_timemgr_EClock_o + type (ESMF_clock),public, target :: seq_timemgr_EClock_i + type (ESMF_clock),public, target :: seq_timemgr_EClock_g + type (ESMF_clock),public, target :: seq_timemgr_EClock_r + type (ESMF_clock),public, target :: seq_timemgr_EClock_w + type (ESMF_clock),public, target :: seq_timemgr_EClock_e + + ! --- Private local data ---------------------------------------------------- + + type(ESMF_Calendar), target, save :: seq_timemgr_cal ! calendar + character(SHR_KIND_CL) ,save :: seq_timemgr_calendar ! calendar string + integer, parameter :: SecPerDay = 86400 ! Seconds per day + + integer :: seq_timemgr_pause_sig_index ! Index of pause comp with smallest dt + logical :: seq_timemgr_esp_run_on_pause ! Run ESP component on pause cycle + logical :: seq_timemgr_end_restart ! write restarts at end of run? + +!=============================================================================== + +contains + +!=============================================================================== +! !IROUTINE: seq_timemgr_clockInit -- Initializes clocks +! +! !DESCRIPTION: +! +! Initializes clock +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_clockInit(SyncClock, nmlfile, restart, restart_file, pioid, mpicom, & + EClock_drv, EClock_atm, EClock_lnd, EClock_ocn, EClock_ice, Eclock_glc, & + Eclock_rof, EClock_wav, Eclock_esp) + +! !USES: + use pio, only : file_desc_T + use shr_file_mod, only : shr_file_getunit, shr_file_freeunit + use shr_mpi_mod, only : shr_mpi_bcast + use seq_io_read_mod + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(seq_timemgr_type), intent(INOUT) :: SyncClock ! sync clock + character(len=*), intent(IN) :: nmlfile ! namelist file + integer, intent(IN) :: mpicom ! MPI communicator + logical, intent(IN) :: restart ! restart logical + character(len=*), intent(IN) :: restart_file + type(ESMF_clock),target, intent(IN) :: EClock_drv ! drv clock + type(ESMF_clock),target, intent(IN) :: EClock_atm ! atm clock + type(ESMF_clock),target, intent(IN) :: EClock_lnd ! lnd clock + type(ESMF_clock),target, intent(IN) :: EClock_ocn ! ocn clock + type(ESMF_clock),target, intent(IN) :: EClock_ice ! ice clock + type(ESMF_clock),target, intent(IN) :: EClock_glc ! glc clock + type(ESMF_clock),target, intent(IN) :: EClock_rof ! rof clock + type(ESMF_clock),target, intent(IN) :: EClock_wav ! wav clock + type(ESMF_clock),target, intent(IN) :: EClock_esp ! esp clock + type(file_desc_t) :: pioid + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_clockInit) ' + type(ESMF_Time) :: StartTime ! Start time + type(ESMF_Time) :: RefTime ! Reference time + type(ESMF_Time) :: CurrTime ! Current time + type(ESMF_Time) :: OffsetTime ! local computed time + type(ESMF_Time) :: StopTime1 ! Stop time + type(ESMF_Time) :: StopTime2 ! Stop time + type(ESMF_TimeInterval) :: TimeStep ! Clock time-step + type(ESMF_CalKind_Flag) :: esmf_caltype ! local esmf calendar + integer :: rc ! Return code + integer :: n, i ! index + logical :: found + integer :: min_dt ! smallest time step + integer :: dtime(max_clocks) ! time-step to use + integer :: offset(max_clocks) ! run offset + integer :: unitn ! i/o unit number + integer :: iam ! pe rank + + character(SHR_KIND_CS) :: calendar ! Calendar type + character(SHR_KIND_CS) :: stop_option ! Stop option units + integer(SHR_KIND_IN) :: stop_n ! Number until stop + integer(SHR_KIND_IN) :: stop_ymd ! Stop date (YYYYMMDD) + integer(SHR_KIND_IN) :: stop_tod ! Stop time-of-day + character(SHR_KIND_CS) :: restart_option ! Restart option units + integer(SHR_KIND_IN) :: restart_n ! Number until restart interval + integer(SHR_KIND_IN) :: restart_ymd ! Restart date (YYYYMMDD) + character(SHR_KIND_CS) :: pause_option ! Pause option units + integer(SHR_KIND_IN) :: pause_n ! Number between pause intervals + character(SHR_KIND_CS) :: pause_component_list ! Pause - resume components + character(SHR_KIND_CS) :: history_option ! History option units + integer(SHR_KIND_IN) :: history_n ! Number until history interval + integer(SHR_KIND_IN) :: history_ymd ! History date (YYYYMMDD) + character(SHR_KIND_CS) :: histavg_option ! Histavg option units + integer(SHR_KIND_IN) :: histavg_n ! Number until histavg interval + integer(SHR_KIND_IN) :: histavg_ymd ! Histavg date (YYYYMMDD) + character(SHR_KIND_CS) :: barrier_option ! Barrier option units + integer(SHR_KIND_IN) :: barrier_n ! Number until barrier interval + integer(SHR_KIND_IN) :: barrier_ymd ! Barrier date (YYYYMMDD) + character(SHR_KIND_CS) :: tprof_option ! tprof option units + integer(SHR_KIND_IN) :: tprof_n ! Number until tprof interval + integer(SHR_KIND_IN) :: tprof_ymd ! tprof date (YYYYMMDD) + integer(SHR_KIND_IN) :: start_ymd ! Start date (YYYYMMDD) + integer(SHR_KIND_IN) :: start_tod ! Start time of day (seconds) + integer(SHR_KIND_IN) :: curr_ymd ! Current ymd (YYYYMMDD) + integer(SHR_KIND_IN) :: curr_tod ! Current tod (seconds) + integer(SHR_KIND_IN) :: ref_ymd ! Reference date (YYYYMMDD) + integer(SHR_KIND_IN) :: ref_tod ! Reference time of day (seconds) + integer(SHR_KIND_IN) :: atm_cpl_dt ! Atmosphere coupling interval + integer(SHR_KIND_IN) :: lnd_cpl_dt ! Land coupling interval + integer(SHR_KIND_IN) :: ice_cpl_dt ! Sea-Ice coupling interval + integer(SHR_KIND_IN) :: ocn_cpl_dt ! Ocean coupling interval + integer(SHR_KIND_IN) :: glc_cpl_dt ! Glc coupling interval + character(SHR_KIND_CS) :: glc_avg_period ! Glc avering coupling period + integer(SHR_KIND_IN) :: rof_cpl_dt ! Runoff coupling interval + integer(SHR_KIND_IN) :: wav_cpl_dt ! Wav coupling interval + integer(SHR_KIND_IN) :: esp_cpl_dt ! Esp coupling interval + integer(SHR_KIND_IN) :: atm_cpl_offset ! Atmosphere coupling interval + integer(SHR_KIND_IN) :: lnd_cpl_offset ! Land coupling interval + integer(SHR_KIND_IN) :: ice_cpl_offset ! Sea-Ice coupling interval + integer(SHR_KIND_IN) :: ocn_cpl_offset ! Ocean coupling interval + integer(SHR_KIND_IN) :: glc_cpl_offset ! Glc coupling interval + integer(SHR_KIND_IN) :: wav_cpl_offset ! Wav coupling interval + integer(SHR_KIND_IN) :: rof_cpl_offset ! Runoff coupling interval + integer(SHR_KIND_IN) :: esp_cpl_offset ! Esp coupling interval + logical :: esp_run_on_pause ! Run ESP on pause cycle + logical :: end_restart ! Write restart at end of run + integer(SHR_KIND_IN) :: ierr ! Return code + + character(len=*), parameter :: F0A = "(2A,A)" + character(len=*), parameter :: F0I = "(2A,I10)" + character(len=*), parameter :: F0L = "(2A,L3)" + + namelist /seq_timemgr_inparm/ calendar, curr_ymd, curr_tod, & + stop_option, stop_n, stop_ymd, stop_tod, & + restart_option, restart_n, restart_ymd, & + pause_option, pause_n, pause_component_list, & + history_option, history_n, history_ymd, & + histavg_option, histavg_n, histavg_ymd, & + barrier_option, barrier_n, barrier_ymd, & + tprof_option, tprof_n, tprof_ymd, & + start_ymd, start_tod, ref_ymd, ref_tod, & + atm_cpl_dt, ocn_cpl_dt, ice_cpl_dt, lnd_cpl_dt, & + atm_cpl_offset, lnd_cpl_offset, ocn_cpl_offset, & + ice_cpl_offset, glc_cpl_dt, glc_cpl_offset, glc_avg_period, & + wav_cpl_dt, wav_cpl_offset, esp_cpl_dt, esp_cpl_offset, & + rof_cpl_dt, rof_cpl_offset, esp_run_on_pause, end_restart +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + SyncClock%ECP(seq_timemgr_nclock_drv)%EClock => EClock_drv + SyncClock%ECP(seq_timemgr_nclock_atm)%EClock => EClock_atm + SyncClock%ECP(seq_timemgr_nclock_lnd)%EClock => EClock_lnd + SyncClock%ECP(seq_timemgr_nclock_ocn)%EClock => EClock_ocn + SyncClock%ECP(seq_timemgr_nclock_ice)%EClock => EClock_ice + SyncClock%ECP(seq_timemgr_nclock_glc)%EClock => EClock_glc + SyncClock%ECP(seq_timemgr_nclock_rof)%EClock => EClock_rof + SyncClock%ECP(seq_timemgr_nclock_wav)%EClock => EClock_wav + SyncClock%ECP(seq_timemgr_nclock_esp)%EClock => EClock_esp + + call mpi_comm_rank(mpicom,iam,ierr) + + !--------------------------------------------------------------------------- + ! Set syncclock on root pe + !--------------------------------------------------------------------------- + + if (iam == 0) then + + !--------------------------------------------------------------------------- + ! Set namelist defaults + !--------------------------------------------------------------------------- + calendar = seq_timemgr_noleap + stop_option = ' ' + stop_n = -1 + stop_ymd = -1 + stop_tod = 0 + restart_option = seq_timemgr_optYearly + restart_n = -1 + restart_ymd = -1 + pause_option = seq_timemgr_optNever + pause_n = -1 + pause_component_list = ' ' + history_option = seq_timemgr_optNever + history_n = -1 + history_ymd = -1 + histavg_option = seq_timemgr_optNever + histavg_n = -1 + histavg_ymd = -1 + barrier_option = seq_timemgr_optNever + barrier_n = -1 + barrier_ymd = -1 + tprof_option = seq_timemgr_optNever + tprof_n = -1 + tprof_ymd = -1 + start_ymd = 0 + start_tod = 0 + ref_ymd = 0 + ref_tod = 0 + curr_ymd = 0 + curr_tod = 0 + atm_cpl_dt = 0 + lnd_cpl_dt = 0 + ice_cpl_dt = 0 + ocn_cpl_dt = 0 + glc_cpl_dt = 0 + glc_avg_period = seq_timemgr_optGLCCouplingPeriod + rof_cpl_dt = 0 + wav_cpl_dt = 0 + esp_cpl_dt = 0 + atm_cpl_offset = 0 + lnd_cpl_offset = 0 + ice_cpl_offset = 0 + ocn_cpl_offset = 0 + glc_cpl_offset = 0 + rof_cpl_offset = 0 + wav_cpl_offset = 0 + esp_cpl_offset = 0 + esp_run_on_pause = .true. + end_restart = .true. + + !--------------------------------------------------------------------------- + ! Read in namelist + !--------------------------------------------------------------------------- + unitn = shr_file_getUnit() + write(logunit,F0A) trim(subname),' Read in seq_timemgr_inparm namelist from: '//trim(nmlfile) + open( unitn, file=trim(nmlfile), status='old' ) + ierr = 1 + do while( ierr /= 0 ) + read(unitn,nml=seq_timemgr_inparm,iostat=ierr) + if (ierr < 0) then + call shr_sys_abort( subname//':: namelist read returns an'// & + ' end of file or end of record condition' ) + end if + end do + close(unitn) + call shr_file_freeUnit( unitn ) + endif + + !--------------------------------------------------------------------------- + ! Read Restart (seq_io is called on all CPLID pes) + ! NOTE: slightly messy, seq_io is only valid on CPLID + !--------------------------------------------------------------------------- + if (restart) then + if (seq_comm_iamin(CPLID)) then + call seq_io_read(restart_file,pioid,start_ymd,'seq_timemgr_start_ymd') + call seq_io_read(restart_file,pioid,start_tod,'seq_timemgr_start_tod') + call seq_io_read(restart_file,pioid,ref_ymd ,'seq_timemgr_ref_ymd') + call seq_io_read(restart_file,pioid,ref_tod ,'seq_timemgr_ref_tod') + call seq_io_read(restart_file,pioid,curr_ymd ,'seq_timemgr_curr_ymd') + call seq_io_read(restart_file,pioid,curr_tod ,'seq_timemgr_curr_tod') + endif + !--- Send from CPLID ROOT to GLOBALID ROOT, use bcast as surrogate + call shr_mpi_bcast(start_ymd,mpicom,pebcast=seq_comm_gloroot(CPLID)) + call shr_mpi_bcast(start_tod,mpicom,pebcast=seq_comm_gloroot(CPLID)) + call shr_mpi_bcast( ref_ymd,mpicom,pebcast=seq_comm_gloroot(CPLID)) + call shr_mpi_bcast( ref_tod,mpicom,pebcast=seq_comm_gloroot(CPLID)) + call shr_mpi_bcast( curr_ymd,mpicom,pebcast=seq_comm_gloroot(CPLID)) + call shr_mpi_bcast( curr_tod,mpicom,pebcast=seq_comm_gloroot(CPLID)) + endif + + if (iam == 0) then + !--------------------------------------------------------------------------- + ! Modify namelist as needed + !--------------------------------------------------------------------------- + + if (lnd_cpl_dt == 0) lnd_cpl_dt = atm_cpl_dt ! Copy atm coupling time into lnd + if (rof_cpl_dt == 0) rof_cpl_dt = atm_cpl_dt ! Copy atm coupling time into rof + if (ice_cpl_dt == 0) ice_cpl_dt = atm_cpl_dt ! Copy atm coupling time into ice + if (ocn_cpl_dt == 0) ocn_cpl_dt = atm_cpl_dt ! Copy atm coupling time into ocn + if (glc_cpl_dt == 0) glc_cpl_dt = atm_cpl_dt ! Copy atm coupling time into glc + if (wav_cpl_dt == 0) wav_cpl_dt = atm_cpl_dt ! Copy atm coupling time into wav + if (esp_cpl_dt == 0) esp_cpl_dt = atm_cpl_dt ! Copy atm coupling time into esp + + if ( ref_ymd == 0 ) then + ref_ymd = start_ymd + ref_tod = start_tod + endif + + if ( curr_ymd == 0 ) then + curr_ymd = start_ymd + curr_tod = start_tod + endif + + if ( stop_ymd < 0) then + stop_ymd = 99990101 + stop_tod = 0 + endif + + if (trim(restart_option) == trim(seq_timemgr_optNone) .or. & + trim(restart_option) == trim(seq_timemgr_optNever)) then + if (end_restart) then + end_restart = .false. + write(logunit,F0A) trim(subname),' WARNING: overriding end_restart to '// & + 'false based on restart_option ' + endif + endif + + if (trim(restart_option) == trim(seq_timemgr_optEnd)) then + restart_option = seq_timemgr_optNone + write(logunit,F0A) trim(subname),' WARNING: overriding restart_option to '// & + 'none and verifying end_restart flag is true ' + if (.not. end_restart) then + end_restart = .true. + write(logunit,F0A) trim(subname),' WARNING: overriding end_restart to '// & + 'true based on restart_option (end) ' + endif + endif + + !--------------------------------------------------------------------------- + ! Print out the namelist settings + !--------------------------------------------------------------------------- + + write(logunit,F0A) ' ' + write(logunit,F0A) trim(subname),' Clock Init Settings:' + write(logunit,F0A) trim(subname),' calendar = ',trim(calendar) + write(logunit,F0A) trim(subname),' stop_option = ',trim(stop_option) + write(logunit,F0I) trim(subname),' stop_n = ',stop_n + write(logunit,F0I) trim(subname),' stop_ymd = ',stop_ymd + write(logunit,F0I) trim(subname),' stop_tod = ',stop_tod + write(logunit,F0A) trim(subname),' restart_option = ',trim(restart_option) + write(logunit,F0I) trim(subname),' restart_n = ',restart_n + write(logunit,F0I) trim(subname),' restart_ymd = ',restart_ymd + write(logunit,F0L) trim(subname),' end_restart = ',end_restart + write(logunit,F0A) trim(subname),' pause_option = ',trim(pause_option) + write(logunit,F0I) trim(subname),' pause_n = ',pause_n + write(logunit,F0A) trim(subname),' pause_component_list = ',trim(pause_component_list) + write(logunit,F0L) trim(subname),' esp_run_on_pause = ',esp_run_on_pause + write(logunit,F0A) trim(subname),' history_option = ',trim(history_option) + write(logunit,F0I) trim(subname),' history_n = ',history_n + write(logunit,F0I) trim(subname),' history_ymd = ',history_ymd + write(logunit,F0A) trim(subname),' histavg_option = ',trim(histavg_option) + write(logunit,F0I) trim(subname),' histavg_n = ',histavg_n + write(logunit,F0I) trim(subname),' histavg_ymd = ',histavg_ymd + write(logunit,F0A) trim(subname),' barrier_option = ',trim(barrier_option) + write(logunit,F0I) trim(subname),' barrier_n = ',barrier_n + write(logunit,F0I) trim(subname),' barrier_ymd = ',barrier_ymd + write(logunit,F0A) trim(subname),' tprof_option = ',trim(tprof_option) + write(logunit,F0I) trim(subname),' tprof_n = ',tprof_n + write(logunit,F0I) trim(subname),' tprof_ymd = ',tprof_ymd + write(logunit,F0I) trim(subname),' start_ymd = ',start_ymd + write(logunit,F0I) trim(subname),' start_tod = ',start_tod + write(logunit,F0I) trim(subname),' ref_ymd = ',ref_ymd + write(logunit,F0I) trim(subname),' ref_tod = ',ref_tod + write(logunit,F0I) trim(subname),' atm_cpl_dt = ',atm_cpl_dt + write(logunit,F0I) trim(subname),' lnd_cpl_dt = ',lnd_cpl_dt + write(logunit,F0I) trim(subname),' ice_cpl_dt = ',ice_cpl_dt + write(logunit,F0I) trim(subname),' ocn_cpl_dt = ',ocn_cpl_dt + write(logunit,F0I) trim(subname),' glc_cpl_dt = ',glc_cpl_dt + write(logunit,F0A) trim(subname),' glc_avg_period = ',glc_avg_period + write(logunit,F0I) trim(subname),' rof_cpl_dt = ',rof_cpl_dt + write(logunit,F0I) trim(subname),' wav_cpl_dt = ',wav_cpl_dt + write(logunit,F0I) trim(subname),' esp_cpl_dt = ',esp_cpl_dt + write(logunit,F0I) trim(subname),' atm_cpl_offset = ',atm_cpl_offset + write(logunit,F0I) trim(subname),' lnd_cpl_offset = ',lnd_cpl_offset + write(logunit,F0I) trim(subname),' ice_cpl_offset = ',ice_cpl_offset + write(logunit,F0I) trim(subname),' ocn_cpl_offset = ',ocn_cpl_offset + write(logunit,F0I) trim(subname),' glc_cpl_offset = ',glc_cpl_offset + write(logunit,F0I) trim(subname),' rof_cpl_offset = ',rof_cpl_offset + write(logunit,F0I) trim(subname),' wav_cpl_offset = ',wav_cpl_offset + write(logunit,F0I) trim(subname),' esp_cpl_offset = ',esp_cpl_offset + write(logunit,F0A) ' ' + + !--------------------------------------------------------------------------- + ! Check a few things + !--------------------------------------------------------------------------- + + ! --- Coupling intervals ------------------------------------------------ + if ( atm_cpl_dt <= 0 .or. & + lnd_cpl_dt /= atm_cpl_dt .or. & + ice_cpl_dt /= atm_cpl_dt .or. & + ocn_cpl_dt <= 0 .or. glc_cpl_dt <= 0 .or. rof_cpl_dt <=0 .or. & + wav_cpl_dt <=0 .or. esp_cpl_dt <=0) then + write(logunit,*) trim(subname),' ERROR: aliogrwe _cpl_dt = ', & + atm_cpl_dt, lnd_cpl_dt, ice_cpl_dt, ocn_cpl_dt, glc_cpl_dt, & + rof_cpl_dt, wav_cpl_dt, esp_cpl_dt + call shr_sys_abort( subname//': ERROR coupling intervals invalid' ) + end if + + ! --- Coupling offsets -------------------------------------------------- + if ( abs(atm_cpl_offset) > atm_cpl_dt .or. & + abs(lnd_cpl_offset) > lnd_cpl_dt .or. & + abs(ice_cpl_offset) > ice_cpl_dt .or. & + abs(glc_cpl_offset) > glc_cpl_dt .or. & + abs(rof_cpl_offset) > rof_cpl_dt .or. & + abs(wav_cpl_offset) > wav_cpl_dt .or. & + abs(esp_cpl_offset) > esp_cpl_dt .or. & + abs(ocn_cpl_offset) > ocn_cpl_dt) then + write(logunit,*) trim(subname),' ERROR: aliogrwe _cpl_offset = ', & + atm_cpl_offset, lnd_cpl_offset, ice_cpl_offset, ocn_cpl_offset, & + glc_cpl_offset, rof_cpl_offset, wav_cpl_offset, esp_cpl_offset + call shr_sys_abort( subname//': ERROR coupling offsets invalid' ) + end if + + ! --- Start time date --------------------------------------------------- + if ( (start_ymd < 101) .or. (start_ymd > 99991231)) then + write(logunit,*) subname,' ERROR: illegal start_ymd',start_ymd + call shr_sys_abort( subname//': ERROR invalid start_ymd') + end if + + endif + + !--------------------------------------------------------------------------- + ! Broadcast namelist data + !--------------------------------------------------------------------------- + call shr_mpi_bcast( calendar, mpicom ) + call shr_mpi_bcast( stop_n, mpicom ) + call shr_mpi_bcast( stop_option, mpicom ) + call shr_mpi_bcast( stop_ymd, mpicom ) + call shr_mpi_bcast( stop_tod, mpicom ) + call shr_mpi_bcast( restart_n, mpicom ) + call shr_mpi_bcast( restart_option, mpicom ) + call shr_mpi_bcast( restart_ymd, mpicom ) + call shr_mpi_bcast( pause_n, mpicom ) + call shr_mpi_bcast( pause_option, mpicom ) + call shr_mpi_bcast( pause_component_list, mpicom ) + call shr_mpi_bcast( history_n, mpicom ) + call shr_mpi_bcast( history_option, mpicom ) + call shr_mpi_bcast( history_ymd, mpicom ) + call shr_mpi_bcast( histavg_n, mpicom ) + call shr_mpi_bcast( histavg_option, mpicom ) + call shr_mpi_bcast( histavg_ymd, mpicom ) + call shr_mpi_bcast( tprof_n, mpicom ) + call shr_mpi_bcast( barrier_n, mpicom ) + call shr_mpi_bcast( barrier_option, mpicom ) + call shr_mpi_bcast( barrier_ymd, mpicom ) + call shr_mpi_bcast( tprof_option, mpicom ) + call shr_mpi_bcast( tprof_ymd, mpicom ) + call shr_mpi_bcast( start_ymd, mpicom ) + call shr_mpi_bcast( start_tod, mpicom ) + call shr_mpi_bcast( ref_ymd, mpicom ) + call shr_mpi_bcast( ref_tod, mpicom ) + call shr_mpi_bcast( curr_ymd, mpicom ) + call shr_mpi_bcast( curr_tod, mpicom ) + call shr_mpi_bcast( atm_cpl_dt, mpicom ) + call shr_mpi_bcast( lnd_cpl_dt, mpicom ) + call shr_mpi_bcast( ice_cpl_dt, mpicom ) + call shr_mpi_bcast( ocn_cpl_dt, mpicom ) + call shr_mpi_bcast( glc_cpl_dt, mpicom ) + call shr_mpi_bcast( glc_avg_period, mpicom ) + call shr_mpi_bcast( rof_cpl_dt, mpicom ) + call shr_mpi_bcast( wav_cpl_dt, mpicom ) + call shr_mpi_bcast( esp_cpl_dt, mpicom ) + call shr_mpi_bcast( atm_cpl_offset, mpicom ) + call shr_mpi_bcast( lnd_cpl_offset, mpicom ) + call shr_mpi_bcast( ice_cpl_offset, mpicom ) + call shr_mpi_bcast( ocn_cpl_offset, mpicom ) + call shr_mpi_bcast( glc_cpl_offset, mpicom ) + call shr_mpi_bcast( rof_cpl_offset, mpicom ) + call shr_mpi_bcast( wav_cpl_offset, mpicom ) + call shr_mpi_bcast( esp_cpl_offset, mpicom ) + call shr_mpi_bcast( esp_run_on_pause, mpicom ) + call shr_mpi_bcast( end_restart, mpicom ) + + ! --- derive a couple things --- + if (trim(histavg_option) == trim(seq_timemgr_optNever) .or. & + trim(histavg_option) == trim(seq_timemgr_optNone)) then + seq_timemgr_histavg_type = seq_timemgr_type_never + elseif (trim(histavg_option) == trim(seq_timemgr_optNHours) .or. & + trim(histavg_option) == trim(seq_timemgr_optNHour)) then + seq_timemgr_histavg_type = seq_timemgr_type_nhour + elseif (trim(histavg_option) == trim(seq_timemgr_optNDays) .or. & + trim(histavg_option) == trim(seq_timemgr_optNDay)) then + seq_timemgr_histavg_type = seq_timemgr_type_nday + elseif (trim(histavg_option) == trim(seq_timemgr_optNMonths) .or. & + trim(histavg_option) == trim(seq_timemgr_optNMonth) .or. & + trim(histavg_option) == trim(seq_timemgr_optMonthly)) then + seq_timemgr_histavg_type = seq_timemgr_type_nmonth + elseif (trim(histavg_option) == trim(seq_timemgr_optNYears) .or. & + trim(histavg_option) == trim(seq_timemgr_optNYear) .or. & + trim(histavg_option) == trim(seq_timemgr_optYearly)) then + seq_timemgr_histavg_type = seq_timemgr_type_nyear + else + seq_timemgr_histavg_type = seq_timemgr_type_other + endif + + + ! --- Initialize generic stuff --- + seq_timemgr_calendar = shr_cal_calendarName(calendar) + seq_timemgr_esp_run_on_pause = esp_run_on_pause + seq_timemgr_end_restart = end_restart + ! --- Figure out which components (if any) are doing pause this run + rc = 1 + i = 1 + if (trim(pause_component_list) == 'all') then + pause_active = .true. + else if (trim(pause_component_list) == 'none') then + pause_active = .false. + else + do + i = scan(trim(pause_component_list(rc:)), ':') - 1 + if ((i < 0) .and. (len_trim(pause_component_list) >= rc)) then + i = len_trim(pause_component_list(rc:)) + end if + if (i > 0) then + found = .false. + do n = 1, max_clocks + if (pause_component_list(rc:rc+i-1) == trim(seq_timemgr_clocks(n))) then + pause_active(n) = .true. + found = .true. + exit + end if + end do + ! Special case for cpl -- synonym for drv + if ((.not. found) .and. (pause_component_list(rc:rc+i-1) == 'cpl')) then + pause_active(seq_timemgr_nclock_drv) = .true. + found = .true. + end if + if (.not. found) then + call shr_sys_abort(subname//': unknown pause component, '//pause_component_list(rc:rc+i-1)) + end if + rc = rc + i + if (pause_component_list(rc:rc) == ':') then + rc = rc + 1 + end if + if (rc >= len_trim(pause_component_list)) then + exit + end if + else + exit + end if + end do + end if + if ( ANY(pause_active) .and. & + (trim(pause_option) /= seq_timemgr_optNONE) .and. & + (trim(pause_option) /= seq_timemgr_optNever)) then + do n = 1, max_clocks + if (pause_active(n)) then + write(logunit, '(4a)') subname, ': Pause active for ', & + trim(seq_timemgr_clocks(n)),' component' + end if + end do + end if + + ! --- Create the new calendar if not already set ------ + if ( trim(seq_timemgr_calendar) == trim(seq_timemgr_noleap)) then + esmf_caltype = ESMF_CALKIND_NOLEAP + else if ( trim(seq_timemgr_calendar) == trim(seq_timemgr_gregorian)) then + esmf_caltype = ESMF_CALKIND_GREGORIAN + else + write(logunit,*) subname//': unrecognized ESMF calendar specified: '// & + trim(seq_timemgr_calendar) + call shr_sys_abort( subname//'ERROR:: bad calendar for ESMF' ) + end if + + seq_timemgr_cal = ESMF_CalendarCreate( name='CCSM_'//seq_timemgr_calendar, & + calkindflag=esmf_caltype, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, subname//': error return from ESMF_CalendarCreate' ) + + ! --- Initialize start, ref, and current date --- + + call seq_timemgr_ETimeInit( StartTime, start_ymd, start_tod, "Start date" ) + call seq_timemgr_ETimeInit( RefTime , ref_ymd , ref_tod , "Reference date" ) + call seq_timemgr_ETimeInit( CurrTime , curr_ymd , curr_tod , "Current date") + + ! --- Figure out what time-stepping interval should be. --------------- + + dtime = 0 + dtime(seq_timemgr_nclock_atm ) = atm_cpl_dt + dtime(seq_timemgr_nclock_lnd ) = lnd_cpl_dt + dtime(seq_timemgr_nclock_ocn ) = ocn_cpl_dt + dtime(seq_timemgr_nclock_ice ) = ice_cpl_dt + dtime(seq_timemgr_nclock_glc ) = glc_cpl_dt + dtime(seq_timemgr_nclock_rof ) = rof_cpl_dt + dtime(seq_timemgr_nclock_wav ) = wav_cpl_dt + dtime(seq_timemgr_nclock_esp ) = esp_cpl_dt + + ! --- this finds the min of dtime excluding the driver value --- + dtime(seq_timemgr_nclock_drv) = maxval(dtime) + dtime(seq_timemgr_nclock_drv) = minval(dtime) + + ! --- For figuring pause cycle + min_dt = maxval(dtime) + seq_timemgr_pause_sig_index = -1 + + do n = 1,max_clocks + if ( mod(dtime(n),dtime(seq_timemgr_nclock_drv)) /= 0) then + write(logunit,*) trim(subname),' ERROR: dtime inconsistent = ',dtime + call shr_sys_abort( subname//' :coupling intervals not compatible' ) + endif + if (pause_active(n) .and. (dtime(n) < min_dt)) then + min_dt = dtime(n) + seq_timemgr_pause_sig_index = n + end if + enddo + if (ANY(pause_active)) then + if (seq_timemgr_pause_sig_index < 1) then + write(logunit, *) subname,"ERROR: No pause_sig_index even with active pause" + call shr_sys_abort(subname//"ERROR: No pause_sig_index even with active pause") + end if + else + ! Don't try to run ESP on non-existent pauses + seq_timemgr_esp_run_on_pause = .false. + end if + + ! --- Initialize component and driver clocks and alarms common to components and driver clocks --- + + do n = 1,max_clocks + call ESMF_TimeIntervalSet( TimeStep, s=dtime(n), rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, subname//': error ESMF_TimeIntervalSet' ) + + call seq_timemgr_EClockInit( TimeStep, StartTime, RefTime, CurrTime, SyncClock%ECP(n)%EClock) + + call seq_timemgr_alarmInit(SyncClock%ECP(n)%EClock, & + EAlarm = SyncClock%EAlarm(n,seq_timemgr_nalarm_run), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(n), & + RefTime = CurrTime, & + alarmname = trim(seq_timemgr_alarm_run)) + + call seq_timemgr_alarmInit(SyncClock%ECP(n)%EClock, & + EAlarm = SyncClock%EAlarm(n,seq_timemgr_nalarm_stop), & + option = stop_option, & + opt_n = stop_n, & + opt_ymd = stop_ymd, & + opt_tod = stop_tod, & + RefTime = CurrTime, & + alarmname = trim(seq_timemgr_alarm_stop)) + + call seq_timemgr_alarmInit(SyncClock%ECP(n)%EClock, & + EAlarm = SyncClock%EAlarm(n,seq_timemgr_nalarm_datestop), & + option = seq_timemgr_optDate, & + opt_ymd = stop_ymd, & + opt_tod = stop_tod, & + RefTime = StartTime, & + alarmname = trim(seq_timemgr_alarm_datestop)) + + call seq_timemgr_alarmInit(SyncClock%ECP(n)%EClock, & + EAlarm = SyncClock%EAlarm(n,seq_timemgr_nalarm_restart), & + option = restart_option, & + opt_n = restart_n, & + opt_ymd = restart_ymd, & + RefTime = CurrTime, & + alarmname = trim(seq_timemgr_alarm_restart)) + + call seq_timemgr_alarmInit(SyncClock%ECP(n)%EClock, & + EAlarm = SyncClock%EAlarm(n,seq_timemgr_nalarm_history), & + option = history_option, & + opt_n = history_n, & + opt_ymd = history_ymd, & + RefTime = StartTime, & + alarmname = trim(seq_timemgr_alarm_history)) + + call seq_timemgr_alarmInit(SyncClock%ECP(n)%EClock, & + EAlarm = SyncClock%EAlarm(n,seq_timemgr_nalarm_histavg), & + option = histavg_option, & + opt_n = histavg_n, & + opt_ymd = histavg_ymd, & + RefTime = StartTime, & + alarmname = trim(seq_timemgr_alarm_histavg)) + + call seq_timemgr_alarmInit(SyncClock%ECP(n)%EClock, & + EAlarm = SyncClock%EAlarm(n,seq_timemgr_nalarm_barrier), & + option = barrier_option, & + opt_n = barrier_n, & + opt_ymd = barrier_ymd, & + RefTime = CurrTime, & + alarmname = trim(seq_timemgr_alarm_barrier)) + + call seq_timemgr_alarmInit(SyncClock%ECP(n)%EClock, & + EAlarm = SyncClock%EAlarm(n,seq_timemgr_nalarm_tprof), & + option = tprof_option, & + opt_n = tprof_n, & + opt_ymd = tprof_ymd, & + RefTime = StartTime, & + alarmname = trim(seq_timemgr_alarm_tprof)) + + call ESMF_AlarmGet(SyncClock%EAlarm(n,seq_timemgr_nalarm_stop), RingTime=StopTime1, rc=rc ) + call ESMF_AlarmGet(SyncClock%EAlarm(n,seq_timemgr_nalarm_datestop), RingTime=StopTime2, rc=rc ) + if (StopTime2 < StopTime1) then + call ESMF_ClockSet(SyncClock%ECP(n)%EClock, StopTime=StopTime2) + else + call ESMF_ClockSet(SyncClock%ECP(n)%EClock, StopTime=StopTime1) + endif + + ! Set the pause option if pause/resume is active + if (pause_active(n)) then + call seq_timemgr_alarmInit(SyncClock%ECP(n)%EClock, & + EAlarm = SyncClock%EAlarm(n,seq_timemgr_nalarm_pause), & + option = pause_option, & + opt_n = pause_n, & + RefTime = CurrTime, & + alarmname = trim(seq_timemgr_alarm_pause)) + else + call seq_timemgr_alarmInit(SyncClock%ECP(n)%EClock, & + EAlarm = SyncClock%EAlarm(n,seq_timemgr_nalarm_pause), & + option = seq_timemgr_optNever, & + opt_n = -1, & + RefTime = StartTime, & + alarmname = trim(seq_timemgr_alarm_pause)) + endif + + enddo + + ! -------------------------------------------------------------------- + ! Set the timing run alarms, these alarms are synced to the driver + ! clock and determine when the component clocks are advanced. + ! We need an offset here of the driver timestep because of the + ! implementation. We are advancing the clock first and we want + ! components to run as soon as possible. Without the driver offset + ! the alarms would go off at the last possible timestep, not first. + ! In addition, we allow the user to set other offsets if desired + ! via namelist. tcraig, 10/2007 + ! -------------------------------------------------------------------- + + offset(seq_timemgr_nclock_drv) = 0 + offset(seq_timemgr_nclock_atm) = atm_cpl_offset + offset(seq_timemgr_nclock_lnd) = lnd_cpl_offset + offset(seq_timemgr_nclock_ocn) = ocn_cpl_offset + offset(seq_timemgr_nclock_ice) = ice_cpl_offset + offset(seq_timemgr_nclock_glc) = glc_cpl_offset + offset(seq_timemgr_nclock_rof) = rof_cpl_offset + offset(seq_timemgr_nclock_wav) = wav_cpl_offset + offset(seq_timemgr_nclock_esp) = esp_cpl_offset + + do n = 1,max_clocks + if (abs(offset(n)) > dtime(n)) then + write(logunit,*) subname,' ERROR: offset too large',n,dtime(n),offset(n) + call shr_sys_abort() + endif + + !--- this is the required driver timestep offset --- + offset(n) = offset(n) + dtime(seq_timemgr_nclock_drv) + + if (mod(offset(n),dtime(seq_timemgr_nclock_drv)) /= 0) then + write(logunit,*) subname,' ERROR: offset not multiple',n,dtime(seq_timemgr_nclock_drv),offset(n) + call shr_sys_abort() + endif + enddo + + ! Set component run alarms on driver clock + + call ESMF_TimeIntervalSet( TimeStep, s=offset(seq_timemgr_nclock_atm), rc=rc ) + OffsetTime = CurrTime + TimeStep + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_atmrun), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(seq_timemgr_nclock_atm), & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_atmrun)) + + call ESMF_TimeIntervalSet( TimeStep, s=offset(seq_timemgr_nclock_lnd), rc=rc ) + OffsetTime = CurrTime + TimeStep + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_lndrun), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(seq_timemgr_nclock_lnd), & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_lndrun)) + + call ESMF_TimeIntervalSet( TimeStep, s=offset(seq_timemgr_nclock_rof), rc=rc ) + OffsetTime = CurrTime + TimeStep + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_rofrun), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(seq_timemgr_nclock_rof), & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_rofrun)) + + call ESMF_TimeIntervalSet( TimeStep, s=offset(seq_timemgr_nclock_ice), rc=rc ) + OffsetTime = CurrTime + TimeStep + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_icerun), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(seq_timemgr_nclock_ice), & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_icerun)) + + call ESMF_TimeIntervalSet( TimeStep, s=offset(seq_timemgr_nclock_wav), rc=rc ) + OffsetTime = CurrTime + TimeStep + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_wavrun), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(seq_timemgr_nclock_wav), & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_wavrun)) + + call ESMF_TimeIntervalSet( TimeStep, s=offset(seq_timemgr_nclock_glc), rc=rc ) + OffsetTime = CurrTime + TimeStep + call ESMF_TimeIntervalSet( TimeStep, s=-offset(seq_timemgr_nclock_drv), rc=rc ) + OffsetTime = OffsetTime + TimeStep + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_glcrun), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(seq_timemgr_nclock_glc), & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_glcrun)) + if (glc_avg_period == seq_timemgr_optGLCCouplingPeriod) then + ! Create this alarm identically to the glcrun alarm (which is created above) + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_glcrun_avg), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(seq_timemgr_nclock_glc), & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_glcrun_avg)) + else if (glc_avg_period == seq_timemgr_optYearly) then + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_glcrun_avg), & + option = seq_timemgr_optYearly, & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_glcrun_avg)) + else + call shr_sys_abort(subname//':: glc_avg_period can only be glc_coupling_period or yearly') + end if + + call ESMF_TimeIntervalSet( TimeStep, s=offset(seq_timemgr_nclock_ocn), rc=rc ) + OffsetTime = CurrTime + TimeStep + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_ocnrun), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(seq_timemgr_nclock_ocn), & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_ocnrun)) + + ! --- this is the ocnrun alarm (there ^) offset by a -dtime of the driver + call ESMF_TimeIntervalSet( TimeStep, s=offset(seq_timemgr_nclock_ocn), rc=rc ) + OffsetTime = CurrTime + TimeStep + call ESMF_TimeIntervalSet( TimeStep, s=-offset(seq_timemgr_nclock_drv), rc=rc ) + OffsetTime = OffsetTime + TimeStep + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_ocnnext), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(seq_timemgr_nclock_ocn), & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_ocnnext)) + + call ESMF_TimeIntervalSet( TimeStep, s=offset(seq_timemgr_nclock_esp), rc=rc ) + OffsetTime = CurrTime + TimeStep + call seq_timemgr_alarmInit(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, & + EAlarm = SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_esprun), & + option = seq_timemgr_optNSeconds, & + opt_n = dtime(seq_timemgr_nclock_esp), & + RefTime = OffsetTime, & + alarmname = trim(seq_timemgr_alarm_esprun)) + +end subroutine seq_timemgr_clockInit + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_EClockGetData -- Get information from the clock +! +! !DESCRIPTION: +! +! Get various values from the clock. +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_EClockGetData( EClock, curr_yr, curr_mon, curr_day, & + curr_ymd, curr_tod, prev_ymd, prev_tod, start_ymd, & + start_tod, StepNo, ref_ymd, ref_tod, & + stop_ymd, stop_tod, dtime, ECurrTime, alarmcount, & + curr_cday, next_cday, curr_time, prev_time, calendar) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Clock), intent(IN) :: EClock ! Input clock object + integer(SHR_KIND_IN), intent(OUT), optional :: curr_yr ! Current year + integer(SHR_KIND_IN), intent(OUT), optional :: curr_mon ! Current month + integer(SHR_KIND_IN), intent(OUT), optional :: curr_day ! Current day in month + integer(SHR_KIND_IN), intent(OUT), optional :: curr_ymd ! Current date YYYYMMDD + integer(SHR_KIND_IN), intent(OUT), optional :: curr_tod ! Current time of day (s) + integer(SHR_KIND_IN), intent(OUT), optional :: prev_ymd ! Previous date YYYYMMDD + integer(SHR_KIND_IN), intent(OUT), optional :: prev_tod ! Previous time of day (s) + integer(SHR_KIND_IN), intent(OUT), optional :: start_ymd ! Starting date YYYYMMDD + integer(SHR_KIND_IN), intent(OUT), optional :: start_tod ! Starting time-of-day (s) + integer(SHR_KIND_IN), intent(OUT), optional :: StepNo ! Number of steps taken + integer(SHR_KIND_IN), intent(OUT), optional :: ref_ymd ! Reference date YYYYMMDD + integer(SHR_KIND_IN), intent(OUT), optional :: ref_tod ! Reference time-of-day (s) + integer(SHR_KIND_IN), intent(OUT), optional :: stop_ymd ! Stop date YYYYMMDD + integer(SHR_KIND_IN), intent(OUT), optional :: stop_tod ! Stop time-of-day (s) + integer(SHR_KIND_IN), intent(OUT), optional :: dtime ! Time-step (seconds) + integer(SHR_KIND_IN), intent(OUT), optional :: alarmcount ! Number of Valid Alarms + type(ESMF_Time), intent(OUT), optional :: ECurrTime ! Current ESMF time + real(SHR_KIND_R8) , intent(OUT), optional :: curr_cday ! current calendar day + real(SHR_KIND_R8) , intent(OUT), optional :: next_cday ! current calendar day + real(SHR_KIND_R8) , intent(OUT), optional :: curr_time ! time interval between current time + ! and reference date + real(SHR_KIND_R8) , intent(OUT), optional :: prev_time ! time interval between previous time + ! and reference date + character(len=*) , intent(OUT), optional :: calendar ! calendar type + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_EClockGetData) ' + type(ESMF_Time) :: CurrentTime ! Current time + type(ESMF_Time) :: PreviousTime ! Previous time + type(ESMF_Time) :: StartTime ! Start time + type(ESMF_Time) :: StopTime ! Stop time + type(ESMF_Time) :: RefTime ! Ref time + type(ESMF_TimeInterval) :: timeStep ! Clock, time-step + type(ESMF_TimeInterval) :: timediff ! Used to calculate curr_time + integer(SHR_KIND_IN) :: rc ! Return code + integer(SHR_KIND_I8) :: advSteps ! Number of time-steps that have advanced + integer(SHR_KIND_IN) :: yy, mm, dd, sec ! Return time values + integer(SHR_KIND_IN) :: ymd ! Date (YYYYMMDD) + integer(SHR_KIND_IN) :: tod ! time of day (sec) + integer(SHR_KIND_IN) :: ldtime ! local dtime + integer(SHR_KIND_IN) :: days ! number of whole days in time interval + integer(SHR_KIND_IN) :: seconds ! number of seconds in time interval + integer(SHR_KIND_IN) :: acount ! number of valid alarms + real(SHR_KIND_R8) :: doy, tmpdoy ! day of year + real(SHR_KIND_R8),parameter :: c1 = 1.0_SHR_KIND_R8 + + type(ESMF_Time) :: tmpTime ! tmp time, needed for next_cday + type(ESMF_TimeInterval) :: tmpDTime ! tmp time interval, needed for next_cday + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + if (present(calendar)) calendar = trim(seq_timemgr_calendar) + + call ESMF_ClockGet( EClock, currTime=CurrentTime, & + advanceCount=advSteps, prevTime=previousTime, TimeStep=timeStep, & + startTime=StartTime, stopTime=stopTime, refTime=RefTime, & + AlarmCount=acount, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_ClockGet" ) + + call ESMF_TimeGet( CurrentTime, yy=yy, mm=mm, dd=dd, s=sec, dayofyear_r8=doy, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_TimeGet" ) + call seq_timemgr_ETimeGet( CurrentTime, ymd=ymd, tod=tod ) + call ESMF_TimeIntervalGet( timeStep, s=ldtime, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_TimeIntervalGet" ) + + if ( present(curr_yr) ) curr_yr = yy + if ( present(curr_mon) ) curr_mon = mm + if ( present(curr_day) ) curr_day = dd + if ( present(curr_tod) ) curr_tod = tod + if ( present(curr_ymd) ) curr_ymd = ymd + if ( present(ECurrTime)) ECurrTime= CurrentTime + if ( present(StepNo) ) StepNo = advSteps + if ( present(dtime) ) dtime = ldtime + if ( present(curr_cday)) curr_cday = doy + if ( present(alarmcount)) alarmcount = acount + if ( present(next_cday)) then + call ESMF_TimeSet(tmpTime, yy=yy, mm=mm, dd=dd, s=tod, calendar=seq_timemgr_cal, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from TimeSet tmpTime") + call ESMF_TimeIntervalSet( tmpDTime, d=1, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from TimeIntSet tmpDTime") + tmpTime = tmpTime + tmpDTime + call ESMF_TimeGet(tmpTime, dayOfYear_r8=tmpdoy, rc=rc) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from TimeGet tmpdoy") + next_cday = tmpdoy + endif + + ! ---Current Time (the time interval between the current date and the reference date) --- + if ( present(curr_time)) then + timediff = CurrentTime - RefTime + call ESMF_TimeIntervalGet(timediff, d=days, s=seconds, rc=rc) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from TimeIntervalGet timediff") + curr_time = days + seconds/real(SecPerDay,SHR_KIND_R8) + end if + + ! ---Previous Time (the time interval between the previous date and the reference date) --- + if ( present(prev_time)) then + timediff = PreviousTime - RefTime + call ESMF_TimeIntervalGet(timediff, d=days, s=seconds, rc=rc) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from TimeIntervalGet timediff") + prev_time = days + seconds/real(SecPerDay,SHR_KIND_R8) + end if + + ! --- Previous time -------------------------------------------------------- + if ( present(prev_ymd) .or. present(prev_tod) )then + call seq_timemgr_ETimeGet( PreviousTime, ymd=ymd, tod=tod ) + if ( present(prev_ymd) ) prev_ymd = ymd + if ( present(prev_tod) ) prev_tod = tod + end if + + ! --- If want start date ----------------------------------------------- + if ( present(start_ymd) .or. present(start_tod) )then + call seq_timemgr_ETimeGet( StartTime, ymd=ymd, tod=tod ) + if ( present(start_ymd) ) start_ymd = ymd + if ( present(start_tod) ) start_tod = tod + end if + + ! --- If want stop date ----------------------------------------------- + if ( present(stop_ymd) .or. present(stop_tod) )then + call seq_timemgr_ETimeGet( stopTime, ymd=ymd, tod=tod ) + if ( present(stop_ymd) ) stop_ymd = ymd + if ( present(stop_tod) ) stop_tod = tod + end if + + ! --- If want ref date ----------------------------------------------- + if ( present(ref_ymd) .or. present(ref_tod) )then + call seq_timemgr_ETimeGet( RefTime, ymd=ymd, tod=tod ) + if ( present(ref_ymd) ) ref_ymd = ymd + if ( present(ref_tod) ) ref_tod = tod + end if + +end subroutine seq_timemgr_EClockGetData +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_clockAdvance -- Advance the syncclock +! +! !DESCRIPTION: +! +! Advance this clock +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_clockAdvance( SyncClock, force_stop, force_stop_ymd, force_stop_tod ) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(seq_timemgr_type), intent(INOUT) :: SyncClock ! Advancing clock + logical, optional, intent(in) :: force_stop ! force stop + integer, optional, intent(in) :: force_stop_ymd ! force stop ymd + integer, optional, intent(in) :: force_stop_tod ! force stop tod + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_clockAdvance) ' + integer :: n + type(ESMF_Time) :: NextAlarm ! Next restart alarm time + integer :: rc ! Return code + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + ! --- set datestop alarm to force_stop alarm --- + + do n = 1,max_clocks + call seq_timemgr_alarmSetOff(SyncClock%ECP(n)%EClock) + if (present(force_stop) .and. present(force_stop_ymd) .and. present(force_stop_tod)) then + if (force_stop) then + if (n == 1 .and. seq_comm_iamroot(CPLID)) then + write(logunit,*) subname,'force stop at ',force_stop_ymd, force_stop_tod + endif + if (force_stop_ymd < 0 .or. force_stop_tod < 0) then + call shr_sys_abort(subname//': force_stop_ymd, force_stop_tod invalid') + endif + seq_timemgr_end_restart = .true. + call seq_timemgr_ETimeInit(NextAlarm, force_stop_ymd, force_stop_tod, "optDate") + CALL ESMF_AlarmSet( SyncClock%EAlarm(n,seq_timemgr_nalarm_datestop), & + name = trim(seq_timemgr_alarm_datestop), & + RingTime=NextAlarm, & + rc=rc ) + endif + endif + enddo + + ! --- advance driver clock and all driver alarms --- + + call ESMF_ClockAdvance( SyncClock%ECP(seq_timemgr_nclock_drv)%EClock, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from drv ESMF_ClockAdvance") + + ! --- advance other clocks if driver component run alarm is ringing --- + + if (ESMF_AlarmIsRinging(SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_atmrun))) then + call ESMF_ClockAdvance(SyncClock%ECP(seq_timemgr_nclock_atm)%EClock, rc=rc ) + call seq_timemgr_ESMFCodeCheck(rc, msg=subname//"Error from atm ESMF_ClockAdvance") + endif + + if (ESMF_AlarmIsRinging(SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_lndrun))) then + call ESMF_ClockAdvance(SyncClock%ECP(seq_timemgr_nclock_lnd)%EClock, rc=rc ) + call seq_timemgr_ESMFCodeCheck(rc, msg=subname//"Error from lnd ESMF_ClockAdvance") + endif + + if (ESMF_AlarmIsRinging(SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_rofrun))) then + call ESMF_ClockAdvance(SyncClock%ECP(seq_timemgr_nclock_rof)%EClock, rc=rc ) + call seq_timemgr_ESMFCodeCheck(rc, msg=subname//"Error from rof ESMF_ClockAdvance") + endif + + if (ESMF_AlarmIsRinging(SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_ocnrun))) then + call ESMF_ClockAdvance(SyncClock%ECP(seq_timemgr_nclock_ocn)%EClock, rc=rc ) + call seq_timemgr_ESMFCodeCheck(rc, msg=subname//"Error from ocn ESMF_ClockAdvance") + endif + + if (ESMF_AlarmIsRinging(SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_icerun))) then + call ESMF_ClockAdvance(SyncClock%ECP(seq_timemgr_nclock_ice)%EClock, rc=rc ) + call seq_timemgr_ESMFCodeCheck(rc, msg=subname//"Error from ice ESMF_ClockAdvance") + endif + + if (ESMF_AlarmIsRinging(SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_glcrun))) then + call ESMF_ClockAdvance(SyncClock%ECP(seq_timemgr_nclock_glc)%EClock, rc=rc ) + call seq_timemgr_ESMFCodeCheck(rc, msg=subname//"Error from glc ESMF_ClockAdvance") + endif + + if (ESMF_AlarmIsRinging(SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_wavrun))) then + call ESMF_ClockAdvance(SyncClock%ECP(seq_timemgr_nclock_wav)%EClock, rc=rc ) + call seq_timemgr_ESMFCodeCheck(rc, msg=subname//"Error from wav ESMF_ClockAdvance") + endif + + if (ESMF_AlarmIsRinging(SyncClock%EAlarm(seq_timemgr_nclock_drv,seq_timemgr_nalarm_esprun))) then + call ESMF_ClockAdvance(SyncClock%ECP(seq_timemgr_nclock_esp)%EClock, rc=rc ) + call seq_timemgr_ESMFCodeCheck(rc, msg=subname//"Error from esp ESMF_ClockAdvance") + endif + + ! Special handling of ESP component if linked to pause cycles + if (seq_timemgr_esp_run_on_pause) then + ! We need to figure out if any pause clock is ringing + call seq_timemgr_alarmSetOff(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock,seq_timemgr_alarm_esprun) + if (seq_timemgr_alarmIsOn(SyncClock%ECP(seq_timemgr_pause_sig_index)%EClock,seq_timemgr_alarm_pause)) then + call seq_timemgr_alarmSetOn(SyncClock%ECP(seq_timemgr_nclock_drv)%EClock,seq_timemgr_alarm_esprun) + end if + end if + + ! Special handling of restart alarm if end_restart is .true. + if (seq_timemgr_end_restart) then + do n = 1,max_clocks + if (seq_timemgr_alarmIsOn(SyncClock%ECP(n)%EClock,seq_timemgr_alarm_stop) .or. & + seq_timemgr_alarmIsOn(SyncClock%ECP(n)%EClock,seq_timemgr_alarm_datestop)) then + call seq_timemgr_alarmSetOn(SyncClock%ECP(n)%EClock,seq_timemgr_alarm_restart) + endif + enddo + endif + +end subroutine seq_timemgr_clockAdvance + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_alarmInit -- Set an alarm +! +! !DESCRIPTION: +! +! Setup an alarm in a clock +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_alarmInit( EClock, EAlarm, option, opt_n, opt_ymd, opt_tod, RefTime, alarmname) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Clock) , intent(INOUT) :: EClock ! clock + type(ESMF_Alarm) , intent(INOUT) :: EAlarm ! alarm + character(len=*) , intent(IN) :: option ! alarm option + integer(SHR_KIND_IN),optional, intent(IN) :: opt_n ! alarm freq + integer(SHR_KIND_IN),optional, intent(IN) :: opt_ymd ! alarm ymd + integer(SHR_KIND_IN),optional, intent(IN) :: opt_tod ! alarm tod (sec) + type(ESMF_Time) ,optional, intent(IN) :: RefTime ! ref time + character(len=*) ,optional, intent(IN) :: alarmname ! alarm name + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_alarmInit): ' + integer :: rc ! Return code + integer :: lymd ! local ymd + integer :: ltod ! local tod + integer :: cyy,cmm,cdd,csec ! time info + integer :: nyy,nmm,ndd,nsec ! time info + character(len=64) :: lalarmname ! local alarm name + logical :: update_nextalarm ! update next alarm + type(ESMF_Time) :: CurrTime ! Current Time + type(ESMF_Time) :: NextAlarm ! Next restart alarm time + type(ESMF_TimeInterval) :: AlarmInterval ! Alarm interval + +!------------------------------------------------------------------------------- +! Notes: This is slightly screwed up because of the way the ESMF alarm +! initializes. The ringtime sent to AlarmCreate MUST be the next +! alarm time. If you send an arbitrary but proper ringtime from +! the past and the ring interval, the alarm will always go off on +! the next clock advance and this will cause serious problems. +! So, even if it makes sense to initialize an alarm with some +! reference time and the alarm interval, that reference time has +! to be advance forward to be >= the current time. In the logic +! below, we set an appropriate "NextAlarm" and then we make sure +! to advance it properly based on the ring interval. +!------------------------------------------------------------------------------- + + lalarmname = 'alarm_unknown' + if (present(alarmname)) then + lalarmname = trim(alarmname) + endif + + ltod = 0 + if (present(opt_tod)) then + ltod = opt_tod + endif + + lymd = -1 + if (present(opt_ymd)) then + lymd = opt_ymd + endif + + call ESMF_ClockGet(EClock, CurrTime=CurrTime, rc=rc) + call ESMF_TimeGet(CurrTime, yy=cyy, mm=cmm, dd=cdd, s=csec, rc=rc ) + + ! --- initial guess of next alarm, this will be updated below --- + if (present(RefTime)) then + NextAlarm = RefTime + else + NextAlarm = CurrTime + endif + call ESMF_TimeGet(CurrTime, yy=nyy, mm=nmm, dd=ndd, s=nsec, rc=rc ) + + update_nextalarm = .true. + + selectcase (trim(option)) + + case (seq_timemgr_optNONE) + !--- tcx seems we need an alarm interval or the alarm create fails, + !--- problem in esmf_wrf_timemgr? + call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) + call ESMF_TimeSet( NextAlarm, yy=9999, mm=12, dd=1, s=0, calendar=seq_timemgr_cal, rc=rc ) + update_nextalarm = .false. + + case (seq_timemgr_optNever) + !--- tcx seems we need an alarm interval or the alarm create fails, + !--- problem in esmf_wrf_timemgr? + call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) + call ESMF_TimeSet( NextAlarm, yy=9999, mm=12, dd=1, s=0, calendar=seq_timemgr_cal, rc=rc ) + update_nextalarm = .false. + + case (seq_timemgr_optDate) + !--- tcx seems we need an alarm interval or the alarm create fails, + !--- problem in esmf_wrf_timemgr? + call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) + if (.not. present(opt_ymd)) call shr_sys_abort(subname//trim(option)//' requires opt_ymd') + if (lymd < 0 .or. ltod < 0) then + call shr_sys_abort(subname//trim(option)//'opt_ymd, opt_tod invalid') + endif + call seq_timemgr_ETimeInit(NextAlarm, lymd, ltod, "optDate") + update_nextalarm = .false. + + case (seq_timemgr_optIfdays0) + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (.not. present(opt_ymd)) call shr_sys_abort(subname//trim(option)//' requires opt_ymd') + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=opt_n, s=0, calendar=seq_timemgr_cal, rc=rc ) + + case (seq_timemgr_optNSteps) + call ESMF_ClockGet(EClock, TimeStep=AlarmInterval, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n + + case (seq_timemgr_optNStep) + call ESMF_ClockGet(EClock, TimeStep=AlarmInterval, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n + + case (seq_timemgr_optNSeconds) + call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n + + case (seq_timemgr_optNSecond) + call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n + + case (seq_timemgr_optNMinutes) + call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n + + case (seq_timemgr_optNMinute) + call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n + + case (seq_timemgr_optNHours) + call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n + + case (seq_timemgr_optNHour) + call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n + + case (seq_timemgr_optNDays) + call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n +! call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=cdd, s=0, calendar=seq_timemgr_cal, rc=rc ) + + case (seq_timemgr_optNDay) + call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n +! call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=cdd, s=0, calendar=seq_timemgr_cal, rc=rc ) + + case (seq_timemgr_optNMonths) + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n +! call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=1, s=0, calendar=seq_timemgr_cal, rc=rc ) + + case (seq_timemgr_optNMonth) + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n +! call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=1, s=0, calendar=seq_timemgr_cal, rc=rc ) + + case (seq_timemgr_optMonthly) + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=1, s=0, calendar=seq_timemgr_cal, rc=rc ) + + case (seq_timemgr_optNYears) + call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n +! call ESMF_TimeSet( NextAlarm, yy=cyy, mm=1, dd=1, s=0, calendar=seq_timemgr_cal, rc=rc ) + + case (seq_timemgr_optNYear) + call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + AlarmInterval = AlarmInterval * opt_n +! call ESMF_TimeSet( NextAlarm, yy=cyy, mm=1, dd=1, s=0, calendar=seq_timemgr_cal, rc=rc ) + + case (seq_timemgr_optYearly) + call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) + call ESMF_TimeSet( NextAlarm, yy=cyy, mm=1, dd=1, s=0, calendar=seq_timemgr_cal, rc=rc ) + + case (seq_timemgr_optEnd) + call shr_sys_abort(subname//'deprecated option '//trim(option)) + + case default + call shr_sys_abort(subname//'unknown option '//trim(option)) + + end select + + ! -------------------------------------------------------------------------------- + ! --- AlarmInterval and NextAlarm should be set --- + ! -------------------------------------------------------------------------------- + + ! --- advance Next Alarm so it won't ring on first timestep for + ! --- most options above. go back one alarminterval just to be careful + + if (update_nextalarm) then + NextAlarm = NextAlarm - AlarmInterval + do while (NextAlarm <= CurrTime) + NextAlarm = NextAlarm + AlarmInterval + enddo + endif + + EAlarm = ESMF_AlarmCreate( name=lalarmname, clock=EClock, ringTime=NextAlarm, & + ringInterval=AlarmInterval, rc=rc) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_AlarmCreate" ) + +end subroutine seq_timemgr_AlarmInit + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_alarmGet -- Get information from the alarm +! +! !DESCRIPTION: +! +! Get various values from the alarm. +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_alarmGet( EAlarm, next_ymd, next_tod, prev_ymd, prev_tod, & + IntSec, IntMon, IntYrs, name) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Alarm) , intent(INOUT) :: EAlarm ! Input Alarm object + integer(SHR_KIND_IN), intent(OUT), optional :: next_ymd ! alarm date yyyymmdd + integer(SHR_KIND_IN), intent(OUT), optional :: next_tod ! alarm tod sec + integer(SHR_KIND_IN), intent(OUT), optional :: prev_ymd ! alarm date yyyymmdd + integer(SHR_KIND_IN), intent(OUT), optional :: prev_tod ! alarm tod sec + integer(SHR_KIND_IN), intent(OUT), optional :: IntSec ! alarm int sec + integer(SHR_KIND_IN), intent(OUT), optional :: IntMon ! alarm int mon + integer(SHR_KIND_IN), intent(OUT), optional :: IntYrs ! alarm int yrs + character(len=*) , intent(OUT), optional :: name ! alarm name + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_alarmGet) ' + integer :: yy, mm, dd, sec ! Return time values + integer :: ymd ! Date (YYYYMMDD) + integer :: tod ! time of day (sec) + integer :: rc ! error code + type(ESMF_TimeInterval) :: alarmInterval ! Alarm interval + type(ESMF_Time) :: ringTime ! Next alarm ring time + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + if (present(name)) then + call ESMF_AlarmGet( EAlarm, name=name, rc=rc) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_AlarmGet name" ) + endif + + call ESMF_AlarmGet( EAlarm, RingTime=RingTime, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_AlarmGet RingTime" ) + call seq_timemgr_ETimeGet( RingTime, ymd=ymd, tod=tod) + if ( present(next_ymd) ) next_ymd = ymd + if ( present(next_tod) ) next_tod = tod + + call ESMF_AlarmGet( EAlarm, PrevRingTime=RingTime, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_AlarmGet PrevRingTime") + call seq_timemgr_ETimeGet( RingTime, ymd=ymd, tod=tod) + if ( present(prev_ymd) ) prev_ymd = ymd + if ( present(prev_tod) ) prev_tod = tod + + yy = 0 + mm = 0 + dd = 0 + sec = 0 + call ESMF_AlarmGet( EAlarm, RingInterval=AlarmInterval, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_AlarmGet RingInterval") + call ESMF_TimeIntervalGet( alarmInterval, yy=yy, mm=mm, d=dd, s=sec, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_TimeIntervalGet" ) + sec = sec + dd*(SecPerDay) + + ! --- If want restart next interval information ------------------------- + if ( present(IntSec) ) IntSec = sec + if ( present(IntMon) ) IntMon = mm + if ( present(IntYrs) ) IntYrs = yy + +end subroutine seq_timemgr_alarmGet +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_alarmSetOn -- turn alarm on +! +! !DESCRIPTION: +! +! turn alarm on +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_AlarmSetOn( EClock, alarmname) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Clock), intent(INOUT) :: EClock ! clock/alarm + character(len=*), intent(IN), optional :: alarmname ! alarmname + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_alarmSetOn) ' + character(len=*), parameter :: xalarm = 'unset' + integer :: n + integer :: rc + logical :: found + logical :: set + character(len=64) :: name + type(ESMF_Alarm),pointer :: EAlarm_list(:) + integer(SHR_KIND_IN) :: AlarmCount ! Number of valid alarms + +!------------------------------------------------------------------------------- +! Notes: The Alarm_list is returned and only a subset of the alarms may +! be initialized. In the esmf_wrf_timemgr, numalarms is not used internally, +! and the alarm pointer is valid if it's associated. If it's not associated +! the AlarmGet calls will generally return an error code. What we really +! want is to ignore the unset alarms. So below, we have to kind of kludge +! this up. We set name=xalarm, a special value, before the AlarmGet call so +! if Alarm_list(n) is not associated, the name will remain the value of +! xalarm. Then we check whether it's a valid alarm by first checking +! the name vs xalarm. If name is not xalarm, then it must be a valid alarm +! and we either set found to true if we are setting all alarms or we compare +! the name returned to the alarm name we're looking for and only set found +! to true if the names match. +!------------------------------------------------------------------------------- + + set = .false. + + call seq_timemgr_EClockGetData(EClock, AlarmCount=AlarmCount) +#ifdef USE_ESMF_LIB + allocate(EAlarm_list(AlarmCount)) + call ESMF_ClockGetAlarmList(EClock, alarmListFlag=ESMF_ALARMLIST_ALL, & + alarmList=EAlarm_list, alarmCount=AlarmCount, rc=rc) +#else + call ESMF_ClockGetAlarmList(EClock, EAlarm_list, rc=rc) +#endif + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_ClockGetAlarmList" ) + do n = 1,AlarmCount + found = .false. + if (present(alarmname)) then + call ESMF_AlarmGet(EAlarm_list(n), name=name) + if (trim(name) == trim(alarmname)) found = .true. + else + found = .true. + endif + if (found) then + set = .true. + call ESMF_AlarmRingerOn( EAlarm_list(n), rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_AlarmRingerOn" ) + endif + enddo + + if (present(alarmname) .and. .not. set) then + write(logunit,*) subname,' ERROR in alarmname ',trim(alarmname) + call shr_sys_abort() + endif +#ifdef USE_ESMF_LIB + deallocate(EAlarm_list) +#endif + +end subroutine seq_timemgr_AlarmSetOn + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_alarmSetOff -- turn alarm off +! +! !DESCRIPTION: +! +! turn alarm off +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_AlarmSetOff( EClock, alarmname) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Clock), intent(INOUT) :: EClock ! clock/alarm + character(len=*), intent(IN), optional :: alarmname ! alarmname + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_alarmSetOff) ' + character(len=*), parameter :: xalarm = 'unset' + integer :: n + integer :: rc + logical :: found + logical :: set + character(len=64) :: name + type(ESMF_Alarm),pointer :: EAlarm_list(:) + integer(SHR_KIND_IN) :: AlarmCount ! Number of valid alarms + +!------------------------------------------------------------------------------- +! Notes: The Alarm_list is returned and only a subset of the alarms may +! be initialized. In the esmf_wrf_timemgr, numalarms is not used internally, +! and the alarm pointer is valid if it's associated. If it's not associated +! the AlarmGet calls will generally return an error code. What we really +! want is to ignore the unset alarms. So below, we have to kind of kludge +! this up. We set name=xalarm, a special value, before the AlarmGet call so +! if Alarm_list(n) is not associated, the name will remain the value of +! xalarm. Then we check whether it's a valid alarm by first checking +! the name vs xalarm. If name is not xalarm, then it must be a valid alarm +! and we either set found to true if we are setting all alarms or we compare +! the name returned to the alarm name we're looking for and only set found +! to true if the names match. +!------------------------------------------------------------------------------- + + set = .false. + + call seq_timemgr_EClockGetData(EClock, AlarmCount=AlarmCount) +#ifdef USE_ESMF_LIB + allocate(EAlarm_list(AlarmCount)) + call ESMF_ClockGetAlarmList(EClock, alarmListFlag=ESMF_ALARMLIST_ALL, & + alarmList=EAlarm_list, alarmCount=AlarmCount, rc=rc) +#else + call ESMF_ClockGetAlarmList(EClock, EAlarm_list, rc=rc) +#endif + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_ClockGetAlarmList" ) + do n = 1,AlarmCount + found = .false. + if (present(alarmname)) then + call ESMF_AlarmGet(EAlarm_list(n), name=name) + if (trim(name) == trim(alarmname)) found = .true. + else + found = .true. + endif + if (found) then + set = .true. + call ESMF_AlarmRingerOff( EAlarm_list(n), rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_AlarmRingerOff" ) + endif + enddo + + if (present(alarmname) .and. .not. set) then + write(logunit,*) subname,' ERROR in alarmname ',trim(alarmname) + call shr_sys_abort() + endif +#ifdef USE_ESMF_LIB + deallocate(EAlarm_list) +#endif + +end subroutine seq_timemgr_AlarmSetOff + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_alarmIsOn -- check if an alarm is ringing +! +! !DESCRIPTION: +! +! check if an alarm is ringing +! +! !INTERFACE: ------------------------------------------------------------------ + +logical function seq_timemgr_alarmIsOn( EClock, alarmname) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Clock), intent(IN) :: EClock ! clock/alarm + character(len=*), intent(IN) :: alarmname ! which alarm + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_alarmIsOn) ' + character(len=*), parameter :: xalarm = 'unset' + integer :: n + integer :: rc + logical :: found + character(len=64) :: name + type(ESMF_Time) :: ETime1, ETime2 + type(ESMF_Alarm),pointer :: EAlarm_list(:) + integer(SHR_KIND_IN) :: AlarmCount ! Number of valid alarms + +!------------------------------------------------------------------------------- +! Notes: Because of the esmf_wrf_timemgr implementation with regards to +! valid alarms in the alarm_list, we initialize name to xalarm before +! querying the alarm name, and if the alarm is not valid, name will not +! be updated and we can tell that the alarm is not valid and we should +! just ignore it. +! Use found to verify alarm was valid. If not, abort +!------------------------------------------------------------------------------- + + seq_timemgr_alarmIsOn = .false. + found = .false. + + call seq_timemgr_EClockGetData(EClock, AlarmCount=AlarmCount) +#ifdef USE_ESMF_LIB + allocate(EAlarm_list(AlarmCount)) + call ESMF_ClockGetAlarmList(EClock, alarmListFlag=ESMF_ALARMLIST_ALL, & + alarmList=EAlarm_list, alarmCount=AlarmCount, rc=rc) +#else + call ESMF_ClockGetAlarmList(EClock, EAlarm_list, rc=rc) +#endif + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_ClockGetAlarmList" ) + do n = 1,AlarmCount + name = trim(xalarm) + call ESMF_AlarmGet(EAlarm_list(n), name=name) + if (trim(name) == trim(alarmname)) then + found = .true. + seq_timemgr_alarmIsOn = ESMF_AlarmIsRinging(alarm=EAlarm_list(n),rc=rc) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname// & + "Error from ESMF_AlarmIsRinging" ) + ! --- make sure the datestop will always stop with dates >= stop_date + if (trim(alarmname) == trim(seq_timemgr_alarm_datestop)) then + call ESMF_ClockGet(EClock, CurrTime = ETime1, rc=rc) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_ClockGet CurrTime" ) + call ESMF_AlarmGet(EAlarm_list(n), RingTime = ETime2, rc=rc) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_AlarmGet RingTime" ) + if (ETime1 >= ETime2) seq_timemgr_alarmIsOn = .true. + endif + endif + enddo + + if (.not.found) then + write(logunit,*) subname//': ERROR alarm not valid for EClock '//trim(alarmname) + call shr_sys_abort( subname//'ERROR: alarm invalid '//trim(alarmname) ) + endif +#ifdef USE_ESMF_LIB + deallocate(EAlarm_list) +#endif + +end function seq_timemgr_alarmIsOn + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_restartAlarmIsOn -- check if an alarm is ringing +! +! !DESCRIPTION: +! +! check if an alarm is ringing +! +! !INTERFACE: ------------------------------------------------------------------ + +logical function seq_timemgr_restartAlarmIsOn( EClock) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Clock) , intent(IN) :: EClock ! clock/alarm + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_restartAlarmIsOn) ' + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + seq_timemgr_restartAlarmIsOn = & + seq_timemgr_alarmIsOn(EClock, alarmname=seq_timemgr_alarm_restart) + +end function seq_timemgr_restartAlarmIsOn + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_stopAlarmIsOn -- check if an alarm is ringing +! +! !DESCRIPTION: +! +! check if an alarm is ringing +! +! !INTERFACE: ------------------------------------------------------------------ + +logical function seq_timemgr_stopAlarmIsOn( EClock) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Clock) , intent(IN) :: EClock ! clock/alarm + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_stopAlarmIsOn) ' + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + seq_timemgr_stopAlarmIsOn = & + seq_timemgr_alarmIsOn(EClock, alarmname=seq_timemgr_alarm_stop) + +end function seq_timemgr_stopAlarmIsOn + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_historyAlarmIsOn -- check if an alarm is ringing +! +! !DESCRIPTION: +! +! check if an alarm is ringing +! +! !INTERFACE: ------------------------------------------------------------------ + +logical function seq_timemgr_historyAlarmIsOn( EClock) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Clock) , intent(IN) :: EClock ! clock/alarm + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_historyAlarmIsOn) ' + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + seq_timemgr_historyAlarmIsOn = & + seq_timemgr_alarmIsOn(EClock, alarmname=seq_timemgr_alarm_history) + +end function seq_timemgr_historyAlarmIsOn + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_pauseAlarmIsOn -- check if an alarm is ringing +! +! !DESCRIPTION: +! +! check if an alarm is ringing +! +! !INTERFACE: ------------------------------------------------------------------ + +logical function seq_timemgr_pauseAlarmIsOn( EClock) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Clock) , intent(IN) :: EClock ! clock/alarm + +!EOP + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_pauseAlarmIsOn) ' + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + seq_timemgr_pauseAlarmIsOn = & + seq_timemgr_alarmIsOn(EClock, alarmname=seq_timemgr_alarm_pause) + + end function seq_timemgr_pauseAlarmIsOn + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_pause_active -- Is pause/resume active this run? +! +! !DESCRIPTION: +! +! Return .true. if any component is configured for pause/resume +! +! !INTERFACE: ------------------------------------------------------------------ + + logical function seq_timemgr_pause_active() + +! !INPUT/OUTPUT PARAMETERS: + +!EOP + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + seq_timemgr_pause_active = ANY(pause_active) + + end function seq_timemgr_pause_active + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_pause_component_index -- return an index for a component +! +! !DESCRIPTION: +! +! Look up a component's internal index for faster processing +! +! !INTERFACE: ------------------------------------------------------------------ + + integer function seq_timemgr_pause_component_index(component_name) + +! !INPUT/OUTPUT PARAMETERS: + + character(len=*), intent(IN) :: component_name + +!EOP + + !----- local ----- + integer :: ind + character(len=*), parameter :: subname = '(seq_timemgr_pause_component_index) ' + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + seq_timemgr_pause_component_index = 0 + do ind = 1, max_clocks + if (trim(component_name) == trim(seq_timemgr_clocks(ind))) then + seq_timemgr_pause_component_index = ind + exit + end if + end do + if (seq_timemgr_pause_component_index < 1) then + if (trim(component_name) == 'cpl') then + seq_timemgr_pause_component_index = seq_timemgr_nclock_drv + end if + end if + if (seq_timemgr_pause_component_index < 1) then + call shr_sys_abort(subname//': No index for component '//trim(component_name)) + end if + + end function seq_timemgr_pause_component_index + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_pause_component_active -- Check if component paused +! +! !DESCRIPTION: +! +! Return .true. if component is active in driver pause +! +! !INTERFACE: ------------------------------------------------------------------ + + logical function seq_timemgr_pause_component_active(component_index) + +! !INPUT/OUTPUT PARAMETERS: + + integer, intent(IN) :: component_index + +!EOP + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_pause_component_active) ' + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + if ((component_index < 1) .or. (component_index > max_clocks)) then + call shr_sys_abort(subname//': component_index out of range') + end if + seq_timemgr_pause_component_active = pause_active(component_index) + + end function seq_timemgr_pause_component_active + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_ETimeInit -- Create ESMF_Time object based on YMD values +! +! !DESCRIPTION: +! +! Create the ESMF_Time object corresponding to the given input time, given in +! YMD (Year Month Day) and TOD (Time-of-day) format. +! Set the time by an integer as YYYYMMDD and integer seconds in the day +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_ETimeInit( ETime, ymd, tod, desc ) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Time) , intent(inout) :: ETime ! Time + integer , intent(in) :: ymd ! Year, month, day YYYYMMDD + integer , intent(in), optional :: tod ! Time of day in seconds + character(len=*), intent(in), optional :: desc ! Description of time to set + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_ETimeInit) ' + integer :: yr, mon, day ! Year, month, day as integers + integer :: ltod ! local tod + character(SHR_KIND_CL) :: ldesc ! local desc + integer :: rc ! return code + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + ltod = 0 + if (present(tod)) then + ltod = tod + endif + + ldesc = '' + if (present(desc)) then + ldesc = desc + endif + + if ( (ymd < 0) .or. (ltod < 0) .or. (ltod > SecPerDay) )then + write(logunit,*) subname//': ERROR yymmdd is a negative number or '// & + 'time-of-day out of bounds', ymd, ltod + call shr_sys_abort( subname//'ERROR: Bad input' ) + end if + + call shr_cal_date2ymd(ymd,yr,mon,day) + + call ESMF_TimeSet( ETime, yy=yr, mm=mon, dd=day, s=ltod, & + calendar=seq_timemgr_cal, rc=rc ) + call seq_timemgr_ESMFCodeCheck(rc, subname//': error return from '// & + 'ESMF_TimeSet: setting '//trim(ldesc)) + +end subroutine seq_timemgr_ETimeInit + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_ETimeGet -- Get the date in YYYYMMDD from from ESMF Time +! +! !DESCRIPTION: +! +! Get the date in YYYYMMDD format from a ESMF time object. +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_ETimeGet( ETime, offset, ymd, tod ) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Time), intent(IN) :: ETime ! Input ESMF time + integer, optional, intent(IN) :: offset ! Offset from input time (sec) + integer, optional, intent(OUT) :: ymd ! date of day + integer, optional, intent(OUT) :: tod ! Time of day + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_ETimeGet) ' + type(ESMF_Time) :: ETimeAdd ! ESMF time + offset + type(ESMF_TimeInterval) :: ETimeOff ! ESMF offset time-interval + integer :: year ! Year + integer :: month ! Month + integer :: day ! Day in month + integer :: sec ! Day in month + integer :: rc ! Return code + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + ETimeAdd = ETime + if ( present(offset) )then + if ( offset > 0 )then + call ESMF_TimeIntervalSet( ETimeOff, s=offset, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname// & + ": Error from ESMF_TimeIntervalSet" ) + ETimeAdd = ETime + ETimeOff + else if ( offset < 0 )then + call ESMF_TimeIntervalSet( ETimeOff, s=-offset, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname// & + ": Error from ESMF_TimeIntervalSet" ) + ETimeAdd = ETime - ETimeOff + end if + end if + + call ESMF_TimeGet( ETimeAdd, yy=year, mm=month, dd=day, s=sec, rc=rc ) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname// & + ": Error from ESMF_TimeGet" ) + + ! shr_cal has restrictions and then "stops", so override that + + if ( present(ymd) ) then + call shr_cal_ymd2date(year,month,day,ymd) + endif + if ( present(tod) ) then + tod = sec + endif + +end subroutine seq_timemgr_ETimeGet + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_EClockInit -- Initialize the ESMF clock in the shared clock +! +! !DESCRIPTION: +! +! Private method: +! +! Setup the ESMF clock inside the wrapped CCSM clock +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_EClockInit( TimeStep, StartTime, RefTime, CurrTime, EClock ) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_TimeInterval), intent(IN) :: TimeStep ! Time-step of clock + type(ESMF_Time) , intent(IN) :: StartTime ! Start time + type(ESMF_Time) , intent(IN) :: RefTime ! Reference time + type(ESMF_Time) , intent(IN) :: CurrTime ! Current time + type(ESMF_Clock) , intent(OUT) :: EClock ! Output ESMF clock + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_EClockInit) ' + integer :: rc ! ESMF return code + character(len=SHR_KIND_CL) :: description ! Description of this clock + type(ESMF_Time) :: clocktime ! Current time + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + description = 'CCSM shared Time-manager clock' + + ! ------ Create ESMF Clock with input characteristics ------------------- + ! --- NOTE: StopTime is required in interface but not used, so use ----- + ! --- something arbitrary. Stop handled via alarm ----- + + call seq_timemgr_ETimeInit(clocktime, 99990101, 0, "artificial stop date") + + EClock = ESMF_ClockCreate(name=trim(description), & + TimeStep=TimeStep, startTime=StartTime, & + refTime=RefTime, stopTime=clocktime, rc=rc) + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//': Error from ESMF_ClockCreate') + + ! ------ Advance clock to the current time (in case of a restart) ------- + call ESMF_ClockGet(EClock, currTime=clocktime, rc=rc ) + call seq_timemgr_ESMFCodeCheck(rc, subname//': Error from ESMF_ClockGet') + do while( clocktime < CurrTime) + call ESMF_ClockAdvance( EClock, rc=rc ) + call seq_timemgr_ESMFCodeCheck(rc, subname//': Error from ESMF_ClockAdvance') + call ESMF_ClockGet( EClock, currTime=clocktime ) + call seq_timemgr_ESMFCodeCheck(rc, subname//': Error from ESMF_ClockGet') + end do + + if (clocktime /= CurrTime) then + if (loglevel > 0) write(logunit,*) trim(subname), & + ' : WARNING clocktime and currtime inconsistent' + endif + +end subroutine seq_timemgr_EClockInit + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_EClockDateInSync -- Check that input date in sync with clock +! +! !DESCRIPTION: +! +! Check that the given input date/time is in sync with clock time +! +! !INTERFACE: ------------------------------------------------------------------ + +logical function seq_timemgr_EClockDateInSync( EClock, ymd, tod, prev) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Clock), intent(IN) :: Eclock ! Input clock to compare + integer, intent(IN) :: ymd ! Date (YYYYMMDD) + integer, intent(IN) :: tod ! Time of day (sec) + logical, optional,intent(IN) :: prev ! If should get previous time + + !----- local ----- + character(len=*), parameter :: subname = "(seq_timemgr_EClockDateInSync) " + type(ESMF_Time) :: ETime + integer :: ymd1 ! Date (YYYYMMDD) + integer :: tod1 ! Time of day + logical :: previous ! If need to get previous time for comparison + integer :: rc ! error code + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + previous = .false. + if ( present(prev) )then + previous = prev + end if + + if (previous )then + call ESMF_ClockGet( EClock, prevTime=ETime, rc=rc) + else + call ESMF_ClockGet( EClock, currTime=ETime, rc=rc) + end if + call seq_timemgr_ETimeGet( ETime, ymd=ymd1, tod=tod1 ) + + ! --- If current dates agree return true -- else false + + if ( (ymd == ymd1) .and. (tod == tod1) )then + seq_timemgr_EClockDateInSync = .true. + else + seq_timemgr_EClockDateInSync = .false. + end if + +end function seq_timemgr_EClockDateInSync + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_clockPrint -- Print clock information out +! +! !DESCRIPTION: +! +! Print clock information out. +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_clockPrint( SyncClock ) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(seq_timemgr_type), intent(in) :: SyncClock ! Input clock to print + + character(len=*), parameter :: subname = "(seq_timemgr_clockPrint) " + integer(SHR_KIND_IN) :: m,n + integer(SHR_KIND_IN) :: curr_ymd ! Current date YYYYMMDD + integer(SHR_KIND_IN) :: curr_tod ! Current time of day (s) + integer(SHR_KIND_IN) :: StepNo ! Number of steps taken + integer(SHR_KIND_IN) :: start_ymd ! Starting date YYYYMMDD + integer(SHR_KIND_IN) :: start_tod ! Starting time-of-day (s) + integer(SHR_KIND_IN) :: stop_ymd ! Stop date YYYYMMDD + integer(SHR_KIND_IN) :: stop_tod ! Stop time-of-day (s) + integer(SHR_KIND_IN) :: ref_ymd ! Reference date YYYYMMDD + integer(SHR_KIND_IN) :: ref_tod ! Reference time-of-day (s) + integer(SHR_KIND_IN) :: DTime ! Time-step (seconds) + integer(SHR_KIND_IN) :: prev_ymd ! Prev restart alarm date (YYYYMMDD) + integer(SHR_KIND_IN) :: prev_tod ! Prev restart alarm time-of-day (sec) + integer(SHR_KIND_IN) :: next_ymd ! Next restart alarm date (YYYYMMDD) + integer(SHR_KIND_IN) :: next_tod ! Next restart alarm time-of-day (sec) + integer(SHR_KIND_IN) :: IntSec ! Alarm interval for seconds + integer(SHR_KIND_IN) :: IntMon ! Alarm interval for months + integer(SHR_KIND_IN) :: IntYrs ! Alarm interval for years + integer(SHR_KIND_IN) :: AlarmCount ! Number of valid alarms + character(len=64) :: alarmname ! Alarm name + character(len=*), parameter :: xalarm = 'unset' + type(ESMF_Alarm),pointer :: EAlarm_list(:) ! EAlarm list associated with EClock + integer(SHR_KIND_IN) :: rc ! error code + + character(len=*), parameter :: F06 = "(2A,L3)" + character(len=*), parameter :: F07 = "(3A)" + character(len=*), parameter :: F08 = "(2A,I8.8,3x,I5.5)" + character(len=*), parameter :: F09 = "(2A,2I8,I12)" + character(len=*), parameter :: F10 = "(2A,I2,2x,A)" + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + if (loglevel <= 0) return + + write(logunit,F07) subname,'calendar = ', trim(seq_timemgr_calendar) + write(logunit,F06) subname,'end_restart = ', seq_timemgr_end_restart + write(logunit,F07) '' + + do n = 1,max_clocks + call seq_timemgr_EClockGetData( SyncClock%ECP(n)%EClock, curr_ymd=curr_ymd, & + curr_tod=curr_tod, start_ymd=start_ymd, & + start_tod=start_tod, StepNo=StepNo, & + ref_ymd=ref_ymd, ref_tod=ref_tod, & + stop_ymd=stop_ymd, stop_tod=stop_tod, & + dtime = dtime, alarmcount=AlarmCount) +#ifdef USE_ESMF_LIB + allocate(EAlarm_list(AlarmCount)) + call ESMF_ClockGetAlarmList(SyncClock%ECP(n)%EClock, alarmListFlag=ESMF_ALARMLIST_ALL, & + alarmList=EAlarm_list, alarmCount=AlarmCount, rc=rc) +#else + call ESMF_ClockGetAlarmList(SyncClock%ECP(n)%EClock, EAlarm_list, rc=rc) +#endif + call seq_timemgr_ESMFCodeCheck( rc, msg=subname//"Error from ESMF_ClockGetAlarmList" ) + + write(logunit,F09) subname,"Clock = "//seq_timemgr_clocks(n),n + write(logunit,F08) subname," Start Time = ", start_ymd, start_tod + write(logunit,F08) subname," Curr Time = ", curr_ymd, curr_tod + write(logunit,F08) subname," Ref Time = ", ref_ymd, ref_tod + write(logunit,F08) subname," Stop Time = ", stop_ymd, stop_tod + write(logunit,F09) subname," Step number = ", StepNo + write(logunit,F09) subname," Dtime = ", DTime + + do m = 1,alarmCount + call seq_timemgr_alarmGet( EAlarm_list(m), & + next_ymd=next_ymd, next_tod=next_tod, prev_ymd=prev_ymd, prev_tod=prev_tod, & + IntSec=IntSec, IntMon=IntMon, IntYrs=IntYrs, name=alarmname ) + write(logunit,F10) subname," Alarm = ",m,trim(alarmname) + write(logunit,F08) subname," Prev Time = ", prev_ymd,prev_tod + write(logunit,F08) subname," Next Time = ", next_ymd,next_tod + write(logunit,F09) subname," Intervl yms = ", IntYrs,IntMon,IntSec + enddo + + write(logunit,*) '' +#ifdef USE_ESMF_LIB + deallocate(EAlarm_list) +#endif + enddo + +end subroutine seq_timemgr_clockPrint + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_ESMFDebug -- Print ESMF stuff for debugging +! +! !DESCRIPTION: +! +! Print ESMF stuff for debugging +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_ESMFDebug( EClock, ETime, ETimeInterval, istring ) + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(ESMF_Clock), optional, intent(in) :: EClock ! ESMF Clock + type(ESMF_Time) , optional, intent(inout) :: ETime ! ESMF Time + type(ESMF_TimeInterval), optional, intent(inout) :: ETimeInterval ! ESMF Time Interval + character(len=*), optional, intent(in) :: istring + + !----- local ----- + character(len=*), parameter :: subname = '(seq_timemgr_ESMFDebug) ' + character(len=128) :: timestring + integer :: yy,mm,dd,s ! ymds + type(ESMF_Time) :: LTime + type(ESMF_TimeInterval) :: LTimeInterval + integer(SHR_KIND_I8) :: LStep + integer :: rc ! return code + +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + if (present(ETime)) then + write(logunit,*) subname,' ETime ',trim(istring) + call ESMF_TimeGet(ETime, yy=yy,mm=mm,dd=dd,s=s,timestring=timestring,rc=rc) + write(logunit,*) subname,rc,'ymds=',yy,mm,dd,s,trim(timestring) + endif + + if (present(ETimeInterval)) then + write(logunit,*) subname,' ETimeInterval ',trim(istring) + call ESMF_TimeIntervalGet(ETimeInterval, yy=yy,mm=mm,d=dd,s=s,timestring=timestring,rc=rc) + write(logunit,*) subname,rc,'ymds=',yy,mm,dd,s,trim(timestring) + endif + + if (present(EClock)) then + write(logunit,*) subname,' EClock ',trim(istring) + call ESMF_ClockGet( EClock, StartTime=LTime ) + call ESMF_TimeGet(LTime, yy=yy,mm=mm,dd=dd,s=s,timestring=timestring,rc=rc) + write(logunit,*) subname,rc,'start ymds=',yy,mm,dd,s,trim(timestring) + call ESMF_ClockGet( EClock, CurrTime=LTime ) + call ESMF_TimeGet(LTime, yy=yy,mm=mm,dd=dd,s=s,timestring=timestring,rc=rc) + write(logunit,*) subname,rc,'curr ymds=',yy,mm,dd,s,trim(timestring) + call ESMF_ClockGet( EClock, StopTime=LTime ) + call ESMF_TimeGet(LTime, yy=yy,mm=mm,dd=dd,s=s,timestring=timestring,rc=rc) + write(logunit,*) subname,rc,'stop ymds=',yy,mm,dd,s,trim(timestring) + call ESMF_ClockGet( EClock, PrevTime=LTime ) + call ESMF_TimeGet(LTime, yy=yy,mm=mm,dd=dd,s=s,timestring=timestring,rc=rc) + write(logunit,*) subname,rc,'prev ymds=',yy,mm,dd,s,trim(timestring) + call ESMF_ClockGet( EClock, RefTime=LTime ) + call ESMF_TimeGet(LTime, yy=yy,mm=mm,dd=dd,s=s,timestring=timestring,rc=rc) + write(logunit,*) subname,rc,'ref ymds=',yy,mm,dd,s,trim(timestring) + call ESMF_ClockGet( EClock, TimeStep=LTimeInterval ) + call ESMF_TimeIntervalGet(LTimeInterval, yy=yy,mm=mm,d=dd,s=s,timestring=timestring,rc=rc) + write(logunit,*) subname,rc,'tint ymds=',yy,mm,dd,s,trim(timestring) + call ESMF_ClockGet( EClock, AdvanceCount=LStep ) + write(logunit,*) subname,rc,'advcnt =',LStep + endif + +end subroutine seq_timemgr_ESMFDebug + +!=============================================================================== +!=============================================================================== +! !IROUTINE: seq_timemgr_ESMFCodeCheck -- Check return-code from ESMF -- abort if not +! +! !DESCRIPTION: +! +! Check ESMF return code and abort if not successful. +! +! !INTERFACE: ------------------------------------------------------------------ + +subroutine seq_timemgr_ESMFCodeCheck( rc, msg ) + +! !USES: + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + integer, intent(in) :: rc ! return code from ESMF + character(len=*),optional,intent(in) :: msg ! error message + + character(len=*),parameter :: subname = 'seq_timemgr_ESMFCodeCheck' +!------------------------------------------------------------------------------- +! Notes: +!------------------------------------------------------------------------------- + + if ( rc == ESMF_SUCCESS ) return + if ( present(msg)) then + write(logunit,*) trim(subname),' error= ',rc,trim(msg) + else + write(logunit,*) trim(subname),' error= ',rc + endif + call shr_sys_flush(logunit) + call shr_sys_abort(trim(subname)) + +end subroutine seq_timemgr_ESMFCodeCheck + +!=============================================================================== +!=============================================================================== + +end module seq_timemgr_mod diff --git a/src/drivers/nuopc/shr/shr_nuopc_dmodel_mod.F90 b/src/drivers/nuopc/shr/shr_nuopc_dmodel_mod.F90 index 1f0d14278ef..7912d389f59 100644 --- a/src/drivers/nuopc/shr/shr_nuopc_dmodel_mod.F90 +++ b/src/drivers/nuopc/shr/shr_nuopc_dmodel_mod.F90 @@ -450,7 +450,10 @@ end subroutine shr_nuopc_dmodel_GridInit !----------------------------------------------------------------------------- subroutine shr_nuopc_dmodel_AttrCopyToInfodata(gcomp, infodata, rc) + ! Get specific set of attributes from gcomp and copy to infodata + + ! input/output parameters type(ESMF_GridComp) ,intent(in) :: gcomp type(seq_infodata_type),intent(inout) :: infodata integer ,intent(inout) :: rc @@ -461,14 +464,14 @@ subroutine shr_nuopc_dmodel_AttrCopyToInfodata(gcomp, infodata, rc) real(r8) :: rvalue logical :: lvalue integer, parameter :: nattrlist = 20 - character(len=*), parameter, dimension(nattrlist) :: attrList = & - (/ "case_name ", "single_column ", "scmlat ", "scmlon ", & - "orb_eccen ", "orb_obliqr ", "orb_lambm0 ", "orb_mvelpp ", & - "read_restart ", "start_type ", "tfreeze_option", "model_version ", & - "info_debug ", "atm_aero ", & - "aqua_planet ", "brnch_rcase ", "perpetual ", "perpetual_ymd ", & - "hostname ", "username " /) + character(len=*), parameter :: attrList(nattrlist) = & + (/ "case_name" ,"single_column","scmlat" ,"scmlon" , & + "orb_eccen" ,"orb_obliqr" ,"orb_lambm0" ,"orb_mvelpp" , & + "read_restart" ,"start_type" ,"tfreeze_option","model_version" , & + "info_debug" ,"atm_aero" ,"aqua_planet" ,"brnch_retain_casename", & + "perpetual" ,"perpetual_ymd","hostname" ,"username"/) character(len=*), parameter :: subname = "(shr_nuopc_dmodel_AttrCopyToInfodata)" + !------------------------------------------- rc = ESMF_Success @@ -538,7 +541,7 @@ subroutine shr_nuopc_dmodel_AttrCopyToInfodata(gcomp, infodata, rc) lvalue = (trim(cvalue) == "true") call seq_infodata_PutData(infodata, aqua_planet=lvalue) - case("brnch_rcase") + case("brnch_retain_casename") lvalue = (trim(cvalue) == "true") call seq_infodata_PutData(infodata, brnch_retain_casename=lvalue) @@ -568,7 +571,6 @@ subroutine shr_nuopc_dmodel_AttrCopyToInfodata(gcomp, infodata, rc) enddo - end subroutine shr_nuopc_dmodel_AttrCopyToInfodata !----------------------------------------------------------------------------- @@ -742,4 +744,4 @@ end subroutine shr_nuopc_dmodel_StateToAvect #endif end module shr_nuopc_dmodel_mod - \ No newline at end of file +