From 4fd370ef6864bcdb5ec478ec24b37a54dbf28c0c Mon Sep 17 00:00:00 2001 From: BinLi-NOAA Date: Wed, 9 Dec 2020 09:03:10 -0500 Subject: [PATCH 01/10] Update CDEPS (#2) Update CDEPS to the 20201124 version of the master branch at ESCOMP/CDEPS. --- .github/workflows/extbuild.yml | 115 + .gitmodules | 3 + CMakeLists.txt | 39 +- cime_config/buildlib | 80 +- cime_config/stream_cdeps.py | 395 ++ cime_config/streams_v2.0.xsd | 216 + cmake/FindPIO.cmake | 103 + cmake/LibCheck.cmake | 104 + cmake/LibFind.cmake | 333 ++ datm/CMakeLists.txt | 2 +- datm/atm_comp_nuopc.F90 | 59 +- datm/cime_config/buildnml | 45 +- datm/cime_config/config_component.xml | 4 +- datm/cime_config/namelist_definition_datm.xml | 2555 +---------- datm/cime_config/stream_definition_datm.xml | 3837 +++++++++++++++++ datm/cime_config/testdefs/testlist_datm.xml | 10 +- datm/datm_datamode_clmncep_mod.F90 | 15 +- datm/datm_datamode_core2_mod.F90 | 15 +- datm/datm_datamode_era5_mod.F90 | 49 +- datm/datm_datamode_jra_mod.F90 | 7 +- dice/CMakeLists.txt | 2 +- dice/cime_config/buildnml | 23 +- dice/cime_config/namelist_definition_dice.xml | 332 +- dice/cime_config/stream_definition_dice.xml | 70 + dice/dice_datamode_ssmi_mod.F90 | 6 +- dice/ice_comp_nuopc.F90 | 38 +- dlnd/CMakeLists.txt | 2 +- dlnd/cime_config/buildnml | 23 +- dlnd/cime_config/namelist_definition_dlnd.xml | 236 +- dlnd/cime_config/stream_definition_dlnd.xml | 50 + dlnd/lnd_comp_nuopc.F90 | 31 +- doc/Makefile | 2 +- doc/source/datm.rst | 126 + doc/source/design_details.rst | 210 + doc/source/index.rst | 16 +- doc/source/introduction.rst | 128 +- doc/source/streams.rst | 398 ++ docn/CMakeLists.txt | 2 +- docn/cime_config/buildnml | 35 +- docn/cime_config/namelist_definition_docn.xml | 349 +- docn/cime_config/stream_definition_docn.xml | 185 + docn/docn_datamode_aquaplanet_mod.F90 | 1 - docn/docn_datamode_copyall_mod.F90 | 5 +- docn/docn_datamode_iaf_mod.F90 | 5 +- docn/docn_datamode_som_mod.F90 | 5 +- docn/ocn_comp_nuopc.F90 | 35 +- drof/CMakeLists.txt | 2 +- drof/cime_config/buildnml | 25 +- drof/cime_config/namelist_definition_drof.xml | 427 +- drof/cime_config/stream_definition_drof.xml | 382 ++ drof/rof_comp_nuopc.F90 | 29 +- dshr/CMakeLists.txt | 7 +- dshr/dshr_dfield_mod.F90 | 21 +- dshr/dshr_fldlist_mod.F90 | 2 - dshr/dshr_mod.F90 | 20 +- dwav/CMakeLists.txt | 2 +- dwav/cime_config/buildnml | 21 +- dwav/cime_config/namelist_definition_dwav.xml | 243 +- dwav/cime_config/stream_definition_dwav.xml | 40 + dwav/wav_comp_nuopc.F90 | 45 +- fox | 1 + share/CMakeLists.txt | 3 +- share/glc_elevclass_mod.F90 | 1 - share/shr_assert_mod.F90.in | 3 +- share/shr_cal_mod.F90 | 12 +- share/shr_mpi_mod.F90 | 4 +- share/shr_sys_mod.F90 | 4 +- streams/CMakeLists.txt | 13 +- streams/dshr_methods_mod.F90 | 40 +- streams/dshr_strdata_mod.F90 | 1023 +++-- streams/dshr_stream_mod.F90 | 82 +- streams/dshr_tinterp_mod.F90 | 6 +- 72 files changed, 7976 insertions(+), 4783 deletions(-) create mode 100644 .github/workflows/extbuild.yml create mode 100644 .gitmodules create mode 100644 cime_config/stream_cdeps.py create mode 100644 cime_config/streams_v2.0.xsd create mode 100644 cmake/FindPIO.cmake create mode 100644 cmake/LibCheck.cmake create mode 100644 cmake/LibFind.cmake create mode 100644 datm/cime_config/stream_definition_datm.xml create mode 100644 dice/cime_config/stream_definition_dice.xml create mode 100644 dlnd/cime_config/stream_definition_dlnd.xml create mode 100644 doc/source/datm.rst create mode 100644 doc/source/design_details.rst create mode 100644 doc/source/streams.rst create mode 100644 docn/cime_config/stream_definition_docn.xml create mode 100644 drof/cime_config/stream_definition_drof.xml create mode 100644 dwav/cime_config/stream_definition_dwav.xml create mode 160000 fox diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml new file mode 100644 index 000000000..845129bb4 --- /dev/null +++ b/.github/workflows/extbuild.yml @@ -0,0 +1,115 @@ +# This is a workflow to compile the cdeps source without cime +name: extbuild +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build-cdeps: + runs-on: ubuntu-latest + env: + CC: mpicc + FC: mpifort + CXX: mpicxx + CPPFLAGS: "-I/usr/include -I/usr/local/include" + # Versions of all dependencies can be updated here + ESMF_VERSION: ESMF_8_1_0_beta_snapshot_25 + PNETCDF_VERSION: pnetcdf-1.12.1 + NETCDF_FORTRAN_VERSION: v4.5.2 + PIO_VERSION: pio-2.5.1 + steps: + - uses: actions/checkout@v2 + # Build the ESMF library, if the cache contains a previous build + # it will be used instead + - id: cache-esmf + uses: actions/cache@v2 + with: + path: ~/ESMF + key: ${{ runner.os }}-${{ env.ESMF_VERSION }}-ESMF + - id: load-env + run: sudo apt-get install gfortran wget openmpi-bin netcdf-bin libopenmpi-dev + - id: build-ESMF + if: steps.cache-esmf.outputs.cache-hit != 'true' + run: | + wget https://github.com/esmf-org/esmf/archive/${{ env.ESMF_VERSION }}.tar.gz + tar -xzvf ${{ env.ESMF_VERSION }}.tar.gz + pushd esmf-${{ env.ESMF_VERSION }} + export ESMF_DIR=`pwd` + export ESMF_COMM=openmpi + export ESMF_YAMLCPP="internal" + export ESMF_INSTALL_PREFIX=$HOME/ESMF + export ESMF_BOPT=g + make + make install + popd + - id: cache-pnetcdf + uses: actions/cache@v2 + with: + path: ~/pnetcdf + key: ${{ runner.os }}-${{ env.PNETCDF_VERSION}}-pnetcdf + - name: pnetcdf build + if: steps.cache-pnetcdf.outputs.cache-hit != 'true' + run: | + wget https://parallel-netcdf.github.io/Release/${{ env.PNETCDF_VERSION }}.tar.gz + tar -xzvf ${{ env.PNETCDF_VERSION }}.tar.gz + ls -l + pushd ${{ env.PNETCDF_VERSION }} + ./configure --prefix=$HOME/pnetcdf --enable-shared --disable-cxx + make + make install + popd + - name: Cache netcdf-fortran + id: cache-netcdf-fortran + uses: actions/cache@v2 + with: + path: ~/netcdf-fortran + key: ${{ runner.os }}-${{ env.NETCDF_FORTRAN_VERSION }}-netcdf-fortran + - name: netcdf fortran build + if: steps.cache-netcdf-fortran.outputs.cache-hit != 'true' + run: | + sudo apt-get install libnetcdf-dev + wget https://github.com/Unidata/netcdf-fortran/archive/${{ env.NETCDF_FORTRAN_VERSION }}.tar.gz + tar -xzvf ${{ env.NETCDF_FORTRAN_VERSION }}.tar.gz + ls -l + pushd netcdf-fortran-* + ./configure --prefix=$HOME/netcdf-fortran + make + make install + + - name: Cache PIO + id: cache-PIO + uses: actions/cache@v2 + with: + path: ~/pio + key: ${{ runner.os }}-${{ env.PIO_VERSION }}.pio + restore-keys: | + ${{ runner.os }}-${{ env.NETCDF_FORTRAN_VERSION }}-netcdf-fortran + ${{ runner.os }}-${{ env.PNETCDF_VERSION }}-pnetcdf + - name: Build PIO + if: steps.cache-PIO.outputs.cache-hit != 'true' + run: | + wget https://github.com/NCAR/ParallelIO/releases/download/pio_2_5_1/${{ env.PIO_VERSION }}.tar.gz + tar -xzvf ${{ env.PIO_VERSION }}.tar.gz + mkdir build-pio + pushd build-pio + cmake -Wno-dev -DNetCDF_C_LIBRARY=/usr/lib/x86_64-linux-gnu/libnetcdf.so -DNetCDF_C_INCLUDE_DIR=/usr/include -DCMAKE_PREFIX_PATH=/usr -DCMAKE_INSTALL_PREFIX=$HOME/pio -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off -DNetCDF_Fortran_PATH=$HOME/netcdf-fortran -DPnetCDF_PATH=$HOME/pnetcdf ../${{ env.PIO_VERSION }} + make VERBOSE=1 + make install + popd + + - name: Build CDEPS + run: | + export ESMFMKFILE=$HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk + export PIO=$HOME/pio + git submodule init + git submodule update + mkdir build-cdeps + pushd build-cdeps + cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_Fortran_FLAGS="-g -Wall -ffree-form -ffree-line-length-none" ../ + make VERBOSE=1 + popd diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..eff7950f6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "fox"] + path = fox + url = https://github.com/ESMCI/fox.git diff --git a/CMakeLists.txt b/CMakeLists.txt index d3b12130f..734fec8de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,5 @@ cmake_minimum_required(VERSION 3.10) - -project(NUOPC_DATA_MODELS LANGUAGES Fortran VERSION 0.1) -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) include(ExternalProject) -find_package(ESMF REQUIRED) if (DEFINED CIMEROOT) message("Using CIME in ${CIMEROOT} with compiler ${COMPILER}") @@ -11,11 +7,34 @@ if (DEFINED CIMEROOT) if (${PIO_VERSION} LESS 2) message( FATAL_ERROR "Version 2 of the PIO library required") endif() - set(FOX ${LIBROOT}) + if (${MPILIB} STREQUAL "mpi-serial") + set(CMAKE_C_COMPILER ${SCC}) + set(CMAKE_Fortran_COMPILER ${SFC}) + set(CMAKE_CXX_COMPILER ${SCXX}) + else() + set(CMAKE_C_COMPILER ${MPICC}) + set(CMAKE_Fortran_COMPILER ${MPIFC}) + set(CMAKE_CXX_COMPILER ${MPICXX}) + endif() set(CMAKE_Fortran_FLAGS "${FFLAGS} -I${LIBROOT}/include -I${LIBROOT}/finclude -I${LIBROOT}/nuopc/esmf/${NINST_VALUE}/include") -else () +else() set(BLD_STANDALONE TRUE) -endif () +endif() + +project(NUOPC_DATA_MODELS LANGUAGES Fortran VERSION 0.1) + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +message("CMAKE_MODULE_PATH is ${CMAKE_MODULE_PATH}") + +find_package(ESMF REQUIRED) +if (DEFINED PIO) + set(PIO_PATH ${PIO}) +else() + set(PIO_PATH $ENV{PIO}) +endif() +find_package(PIO REQUIRED COMPONENT C Fortran PATH ${PIO_PATH}) + if (NOT DEFINED MPILIB OR NOT ${MPILIB} STREQUAL "mpi-serial") find_package(MPI REQUIRED) endif() @@ -23,10 +42,10 @@ endif() if(BLD_STANDALONE) add_subdirectory(share) list(APPEND EXTRA_LIBS cdeps_share) - list(APPEND EXTRA_INCLUDES "${PIO_INCDIR}" "${CMAKE_BINARY_DIR}/share" ) + list(APPEND EXTRA_INCLUDES "${CMAKE_BINARY_DIR}/share" ) endif() - +add_subdirectory(fox) add_subdirectory(streams) add_subdirectory(dshr) @@ -35,4 +54,4 @@ foreach(COMP datm dice dlnd docn drof dwav) endforeach(COMP) install(TARGETS streams dshr - LIBRARY DESTINATION lib) + LIBRARY DESTINATION lib) diff --git a/cime_config/buildlib b/cime_config/buildlib index 24a498e03..c3ca2780a 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -4,11 +4,16 @@ build cime component model library. This buildlib script is used by all CDEPS components. """ -import sys, os +import sys, os, time -_CIMEROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..","..","..","..", "..") +_CIMEROOT = os.environ.get("CIMEROOT") +if _CIMEROOT is None: + raise SystemExit("ERROR: must set CIMEROOT environment variable") sys.path.append(os.path.join(_CIMEROOT, "scripts", "Tools")) +_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") +sys.path.append(_LIBDIR) + from standard_script_setup import * from CIME.buildlib import parse_input from CIME.case import Case @@ -22,7 +27,6 @@ logger = logging.getLogger(__name__) def buildlib(bldroot, libroot, case, compname=None): if bldroot.endswith("obj") and not compname: compname = os.path.basename(os.path.abspath(os.path.join(bldroot,os.pardir))) - print "HERE compname is {} libroot={} bldroot={}".format(compname, libroot, bldroot) if case.get_value("DEBUG"): strdebug = "debug" @@ -37,6 +41,7 @@ def buildlib(bldroot, libroot, case, compname=None): sharedpath = os.path.join(case.get_value("COMPILER"),mpilib, strdebug, strthread, "nuopc") + exe_root = case.get_value("EXEROOT") if compname: s, o, e = run_cmd("make d{}".format(compname), from_dir=bldroot, verbose=True) @@ -49,24 +54,44 @@ def buildlib(bldroot, libroot, case, compname=None): expect(False, "ERROR in {} build {} {}".format(compname,o,e)) else: logger.info("Running cmake for CDEPS") - srcpath = os.path.join(case.get_value("CIMEROOT"),"src","components","cdeps") - + srcpath = os.path.abspath(os.path.join(os.path.dirname(__file__),os.pardir)) cmake_flags = get_standard_cmake_args(case, os.path.join(sharedpath,"cdeps"), shared_lib=True) - ccomp, cxxcomp, fcomp = get_compiler_names(case) - - cmake_flags += " -DCMAKE_C_COMPILER={} -DCMAKE_CXX_COMPILER={} -DCMAKE_Fortran_COMPILER={}".format(ccomp, cxxcomp, fcomp) - cmake_flags += " -DCMAKE_INSTALL_PREFIX={} ".format(libroot) - cmake_flags += " -DLIBROOT={} ".format(libroot) + srcpath + # base path of install to be completed by setting DESTDIR in make install + cmake_flags += " -DCMAKE_INSTALL_PREFIX:PATH=/" + cmake_flags += " -DLIBROOT={} ".format(libroot) cmake_flags += " -DMPILIB={} ".format(mpilib) + cmake_flags += " -DPIO_C_LIBRARY={path}/lib -DPIO_C_INCLUDE_DIR={path}/include ".format(path=os.path.join(case.get_value("EXEROOT"),sharedpath)) + cmake_flags += " -DPIO_Fortran_LIBRARY={path}/lib -DPIO_Fortran_INCLUDE_DIR={path}/include ".format(path=os.path.join(case.get_value("EXEROOT"),sharedpath)) + cmake_flags += srcpath + + latest_src_file = max(all_files_under(srcpath), key=os.path.getmtime) + src_time = os.path.getmtime(latest_src_file) + if os.path.exists(os.path.join(bldroot,"CMakeFiles")): + bld_time = os.path.getmtime(os.path.join(bldroot,"CMakeFiles")) + else: + bld_time = src_time - 1 - logger.info("cmake_flags {}".format(cmake_flags)) - s,o,e = run_cmd("cmake {} ".format(cmake_flags), from_dir=bldroot, verbose=True) - expect(not s,"ERROR from cmake output={}, error={}".format(o,e)) - - s,o,e = run_cmd("make install", from_dir=bldroot, verbose=True) + # if any file in src is newer than CmakeFiles in the build directory, rerun cmake + if src_time > bld_time: + logger.info("cmake_flags {}".format(cmake_flags)) + s,o,e = run_cmd("cmake {} ".format(cmake_flags), from_dir=bldroot, verbose=True) + expect(not s,"ERROR from cmake output={}, error={}".format(o,e)) + else: + # The dwav_lib is the last file built in cdeps, wait for it to be built + dwav_lib = os.path.join(bldroot,"dwav","libdwav.a") + time_to_wait = 300 + time_counter = 0 + while not os.path.exists(dwav_lib): + time.sleep(1) + time_counter += 1 + if time_counter > time_to_wait: + break + expect(time_counter <= time_to_wait," Timeout waiting for {}".format(dwav_lib)) + print("HERE exeroot {} bldroot {}".format(exe_root, bldroot)) + + s,o,e = run_cmd("make install DESTDIR={}".format(libroot), from_dir=bldroot, verbose=True) expect(not s,"ERROR from make output={}, error={}".format(o,e)) - # Link the CDEPS component directories to the location expected by cime for comp in ("atm", "lnd", "ice", "ocn", "rof", "wav"): compname = case.get_value("COMP_{}".format(comp.upper())) @@ -76,18 +101,27 @@ def buildlib(bldroot, libroot, case, compname=None): os.rmdir(comppath) symlink_force(os.path.join(bldroot,compname), comppath) +def all_files_under(path): + """Iterates through all files that are under the given path.""" + for cur_path, dirnames, filenames in os.walk(path): + for filename in filenames: + yield os.path.join(cur_path, filename) def get_compiler_names(case): - machobj = Machines(machine=case.get_value("MACH")) + machine=case.get_value("MACH") + machobj = Machines(machine=machine) compobj = Compilers(machobj) + compiler = case.get_value("COMPILER") if case.get_value("MPILIB") == 'mpi-serial': - ccomp = compobj.get_value("SCC").strip() - cxxcomp = compobj.get_value("SCXX").strip() - fcomp = compobj.get_value("SFC").strip() + print("HERE Compiler {} mach={}".format(compiler, machine)) + ccomp = compobj.get_value("SCC",{"COMPILER":compiler,"MACH":machine}).strip() + cxxcomp = compobj.get_value("SCXX",{"COMPILER":compiler}).strip() + fcomp = compobj.get_value("SFC",{"COMPILER":compiler}).strip() + print("HERE the compilers are {} {} {}".format(ccomp,cxxcomp, fcomp)) else: - ccomp = compobj.get_value("MPICC").strip() - cxxcomp = compobj.get_value("MPICXX").strip() - fcomp = compobj.get_value("MPIFC").strip() + ccomp = compobj.get_value("MPICC",{"COMPILER":compiler}).strip() + cxxcomp = compobj.get_value("MPICXX",{"COMPILER":compiler}).strip() + fcomp = compobj.get_value("MPIFC",{"COMPILER":compiler}).strip() return ccomp, cxxcomp, fcomp diff --git a/cime_config/stream_cdeps.py b/cime_config/stream_cdeps.py new file mode 100644 index 000000000..9f69f6693 --- /dev/null +++ b/cime_config/stream_cdeps.py @@ -0,0 +1,395 @@ +""" +Interface to the streams.xml style files. This class inherits from GenericXML.py + +stream files predate cime and so do not conform to entry id format +""" +import datetime +import re +import hashlib + +from standard_script_setup import * +from CIME.XML.standard_module_setup import * +from CIME.XML.generic_xml import GenericXML +from CIME.XML.files import Files +from CIME.utils import expect + +logger = logging.getLogger(__name__) + +_var_ref_re = re.compile(r"\$(\{)?(?P\w+)(?(1)\})") + +_ymd_re = re.compile(r"%(?P[1-9][0-9]*)?y(?Pm(?Pd)?)?") + +_stream_nuopc_file_template = """ + + {stream_taxmode} + {stream_tintalgo} + {stream_readmode} + {stream_mapalgo} + {stream_dtlimit} + {stream_year_first} + {stream_year_last} + {stream_year_align} + {stream_vectors} + {stream_meshfile} + {stream_lev_dimname} + + {stream_datafiles} + + + {stream_datavars} + + {stream_offset} + + +""" + +class StreamCDEPS(GenericXML): + + def __init__(self, infile, schema): + """ + Initialize a CDEPS stream object + """ + logger.debug("Verifying using schema {}".format(schema)) + GenericXML.__init__(self, infile, schema) + if os.path.exists(infile): + GenericXML.read(self, infile, schema) + + def create_stream_xml(self, stream_names, case, streams_xml_file, data_list_file): + """ + Create the stream xml file and append the required stream input data to the input data list file + """ + # write header of stream file + with open(streams_xml_file, 'w') as stream_file: + stream_file.write('\n') + stream_file.write('\n') + # write contents of stream file + for stream_name in stream_names: + if stream_name: + self.stream_nodes = super(StreamCDEPS,self).get_child("stream_entry", {"name" : stream_name}, + err_msg="No stream_entry {} found".format(stream_name)) + + # determine stream_year_first and stream_year_list + data_year_first,data_year_last = self._get_stream_first_and_last_dates(self.stream_nodes, case) + + # now write the data model streams xml file + stream_vars = {} + stream_vars['streamname'] = stream_name + attributes = {} + for node in self.get_children(root=self.stream_nodes): + node_name = node.xml_element.tag.strip() + + if node_name == 'stream_datavars': + # Get the resolved stream data variables + stream_vars[node_name] = None + for child in self.get_children(root=node): + datavars = child.xml_element.text.strip() + datavars = self._resolve_values(case, datavars) + datavars = self._sub_glc_fields(datavars, case) + datavars = self._add_xml_delimiter(datavars.split("\n"), "var") + if stream_vars[node_name]: + stream_vars[node_name] = stream_vars[node_name] + "\n " + datavars.strip() + else: + stream_vars[node_name] = datavars.strip() + # endif + + elif node_name == 'stream_datafiles': + # Get the resolved stream data files + stream_vars[node_name] = "" + for child in self.get_children(root=node): + stream_datafiles = child.xml_element.text + stream_datafiles = self._resolve_values(case, stream_datafiles) + if 'first_year' in child.xml_element.attrib and 'last_year' in child.xml_element.attrib: + stream_year_first= int(child.xml_element.get('first_year')) + stream_year_last = int(child.xml_element.get('last_year')) + year_first = max(stream_year_first, data_year_first) + year_last = min(stream_year_last, data_year_last) + stream_datafiles = self._sub_paths(stream_datafiles, year_first, year_last) + stream_datafiles = stream_datafiles.strip() + #endif + if stream_vars[node_name]: + stream_vars[node_name] += "\n " + self._add_xml_delimiter(stream_datafiles.split("\n"), "file") + else: + stream_vars[node_name] = self._add_xml_delimiter(stream_datafiles.split("\n"), "file") + + elif ( node_name == 'stream_meshfile' + or node_name == 'stream_mapalgo' + or node_name == 'stream_tintalgo' + or node_name == 'stream_taxmode' + or node_name == 'stream_dtlimit'): + attributes['model_grid'] = case.get_value("GRID") + value = self._get_value_match(node, node_name[7:], attributes=attributes) + value = self._resolve_values(case, value) + value = value.strip() + stream_vars[node_name] = value + + elif node_name.strip(): + # Get the other dependencies + stream_dict = self._add_value_to_dict(stream_vars, case, node) + + # append to stream xml file + stream_file_text = _stream_nuopc_file_template.format(**stream_vars) + with open(streams_xml_file, 'a') as stream_file: + stream_file.write(stream_file_text) + + # append to input_data_list + stream_meshfile = stream_vars['stream_meshfile'].strip() + self._add_entries_to_inputdata_list(stream_meshfile, stream_datafiles, data_list_file) + + # write close of stream xml file + with open(streams_xml_file, 'a') as stream_file: + stream_file.write("\n") + + def _get_stream_first_and_last_dates(self, stream, case): + """ + Get first and last dates for data for the stream file + """ + for node in self.get_children(root=stream): + if node.xml_element.tag == 'stream_year_first': + data_year_first = node.xml_element.text.strip() + data_year_first = int(self._resolve_values(case, data_year_first)) + if node.xml_element.tag == 'stream_year_last': + data_year_last = node.xml_element.text.strip() + data_year_last = int(self._resolve_values(case, data_year_last)) + return data_year_first, data_year_last + + def _add_entries_to_inputdata_list(self, stream_meshfile, stream_datafiles, data_list_file): + """ + Appends input data information entries to input data list file + and writes out the new file + """ + lines_hash = self._get_input_file_hash(data_list_file) + with open(data_list_file, 'a') as input_data_list: + # write out the mesh file separately + string = "mesh = {}\n".format(stream_meshfile) + hashValue = hashlib.md5(string.rstrip().encode('utf-8')).hexdigest() + if hashValue not in lines_hash: + input_data_list.write(string) + # now append the stream_datafile entries + for i, filename in enumerate(stream_datafiles.split("\n")): + if filename.strip() == '': + continue + string = "file{:d} = {}\n".format(i+1, filename) + hashValue = hashlib.md5(string.rstrip().encode('utf-8')).hexdigest() + if hashValue not in lines_hash: + input_data_list.write(string) + + def _get_input_file_hash(self, data_list_file): + """ + Determine a hash for the input data file + """ + lines_hash = set() + if os.path.isfile(data_list_file): + with open(data_list_file, "r") as input_data_list: + for line in input_data_list: + hashValue = hashlib.md5(line.rstrip().encode('utf-8')).hexdigest() + logger.debug( "Found line {} with hash {}".format(line,hashValue)) + lines_hash.add(hashValue) + return lines_hash + + def _get_value_match(self, node, child_name, attributes=None, exact_match=False): + ''' + Get the first best match for multiple tags in child_name based on the + attributes input + + + X + Y + Z + + + ''' + # Store nodes that match the attributes and their scores. + matches = [] + nodes = self.get_children(child_name, root=node) + for vnode in nodes: + # For each node in the list start a score. + score = 0 + if attributes: + for attribute in self.attrib(vnode).keys(): + # For each attribute, add to the score. + score += 1 + # If some attribute is specified that we don't know about, + # or the values don't match, it's not a match we want. + if exact_match: + if attribute not in attributes or \ + attributes[attribute] != self.get(vnode, attribute): + score = -1 + break + else: + if attribute not in attributes or not \ + re.search(self.get(vnode, attribute),attributes[attribute]): + score = -1 + break + + # Add valid matches to the list. + if score >= 0: + matches.append((score, vnode)) + + if not matches: + return None + + # Get maximum score using either a "last" or "first" match in case of a tie + max_score = -1 + mnode = None + for score,node in matches: + # take the *first* best match + if score > max_score: + max_score = score + mnode = node + + return self.text(mnode) + + def _add_value_to_dict(self, stream_dict, case, node): + """ + Adds a value to the input stream dictionary needed for the + stream file output Returns the uppdated stream_dict + """ + name = node.xml_element.tag + value = node.xml_element.text + value = self._resolve_values(case, value) + stream_dict[name] = value + return stream_dict + + def _resolve_values(self, case, value): + """ + Substitues $CASEROOT env_xxx.xml variables if they appear in "value" + Returns a string + """ + match = _var_ref_re.search(value) + while match: + env_val = case.get_value(match.group('name')) + expect(env_val is not None, + "Namelist default for variable {} refers to unknown XML variable {}.". + format(value, match.group('name'))) + value = value.replace(match.group(0), str(env_val), 1) + match = _var_ref_re.search(value) + return value + + def _sub_glc_fields(self, datavars, case): + """Substitute indicators with given values in a list of fields. + + Replace any instance of the following substring indicators with the + appropriate values: + %glc = two-digit GLC elevation class from 00 through glc_nec + + The difference between this function and `_sub_paths` is that this + function is intended to be used for variable names (especially from the + `strm_datvar` defaults), whereas `_sub_paths` is intended for use on + input data file paths. + + Returns a string. + + Example: If `_sub_fields` is called with an array containing two + elements, each of which contains two strings, and glc_nec=3: + foo bar + s2x_Ss_tsrf%glc tsrf%glc + then the returned array will be: + foo bar + s2x_Ss_tsrf00 tsrf00 + s2x_Ss_tsrf01 tsrf01 + s2x_Ss_tsrf02 tsrf02 + s2x_Ss_tsrf03 tsrf03 + """ + lines = datavars.split("\n") + new_lines = [] + for line in lines: + if not line: + continue + if "%glc" in line: + if case.get_value('GLC_NEC') == 0: + glc_nec_indices = [] + else: + glc_nec_indices = range(case.get_value('GLC_NEC')+1) + for i in glc_nec_indices: + new_lines.append(line.replace("%glc", "{:02d}".format(i))) + else: + new_lines.append(line) + return "\n".join(new_lines) + + @staticmethod + def _days_in_month(month, year=1): + """Number of days in the given month (specified as an int, 1-12). + + The `year` argument gives the year for which to request the number of + days, in a Gregorian calendar. Defaults to `1` (not a leap year). + """ + month_start = datetime.date(year, month, 1) + if month == 12: + next_year = year+1 + next_month = 1 + else: + next_year = year + next_month = month + 1 + next_month_start = datetime.date(next_year, next_month, 1) + return (next_month_start - month_start).days + + def _sub_paths(self, filenames, year_start, year_end): + """Substitute indicators with given values in a list of filenames. + + Replace any instance of the following substring indicators with the + appropriate values: + %y = year from the range year_start to year_end + %ym = year-month from the range year_start to year_end with all 12 + months + %ymd = year-month-day from the range year_start to year_end with + all 12 months + + For the date indicators, the year may be prefixed with a number of + digits to use (the default is 4). E.g. `%2ymd` can be used to change the + number of year digits from 4 to 2. + + Note that we assume that there is no mixing and matching of date + indicators, i.e. you cannot use `%4ymd` and `%2y` in the same line. Note + also that we use a no-leap calendar, i.e. every month has the same + number of days every year. + + The difference between this function and `_sub_fields` is that this + function is intended to be used for file names (especially from the + `strm_datfil` defaults), whereas `_sub_fields` is intended for use on + variable names. + + Returns a string (filenames separated by newlines). + """ + lines = [line for line in filenames.split("\n") if line] + new_lines = [] + for line in lines: + match = _ymd_re.search(filenames) + if match is None: + new_lines.append(line) + continue + if match.group('digits'): + year_format = "{:0"+match.group('digits')+"d}" + else: + year_format = "{:04d}" + for year in range(year_start, year_end+1): + if match.group('day'): + for month in range(1, 13): + days = self._days_in_month(month) + for day in range(1, days+1): + date_string = (year_format + "-{:02d}-{:02d}").format(year, month, day) + new_line = line.replace(match.group(0), date_string) + new_lines.append(new_line) + elif match.group('month'): + for month in range(1, 13): + date_string = (year_format + "-{:02d}").format(year, month) + new_line = line.replace(match.group(0), date_string) + new_lines.append(new_line) + else: + date_string = year_format.format(year) + new_line = line.replace(match.group(0), date_string) + new_lines.append(new_line) + return "\n".join(new_lines) + + @staticmethod + def _add_xml_delimiter(list_to_deliminate, delimiter): + expect(delimiter and not " " in delimiter, "Missing or badly formed delimiter") + pred = "<{}>".format(delimiter) + postd = "".format(delimiter) + for n,item in enumerate(list_to_deliminate): + if item.strip(): + list_to_deliminate[n] = pred + item.strip() + postd + #endif + #endfor + return "\n ".join(list_to_deliminate) + + diff --git a/cime_config/streams_v2.0.xsd b/cime_config/streams_v2.0.xsd new file mode 100644 index 000000000..2509cf25c --- /dev/null +++ b/cime_config/streams_v2.0.xsd @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cmake/FindPIO.cmake b/cmake/FindPIO.cmake new file mode 100644 index 000000000..2a7af648a --- /dev/null +++ b/cmake/FindPIO.cmake @@ -0,0 +1,103 @@ +# - Try to find PIO +# +# This can be controled by setting PIO_PATH or PIO__PATH Cmake variables, +# where is the COMPONENT language one needs. +# +# Once done, this will define: +# +# PIO__FOUND (BOOL) - system has PIO +# PIO__IS_SHARED (BOOL) - whether the library is shared/dynamic +# PIO__INCLUDE_DIR (PATH) - Location of the header files and modules +# PIO__LIBRARY (File) - Path to the library files +# PIO__LIBRARIES (List) - link these to use PIO +# +# Available COMPONENTS are: C Fortran +# If no components are specified only C is assumed +include (LibFind) +include (LibCheck) + +# Define PIO C Component +define_package_component(PIO DEFAULT + COMPONENT C + INCLUDE_NAMES pio.h + LIBRARY_NAMES pioc) + +# Define PIO Fortran Component +define_package_component(PIO + COMPONENT Fortran + INCLUDE_NAMES pio.mod pio.inc + LIBRARY_NAMES piof) + +# Search for list of valid components requested +find_valid_components(PIO) + +#============================================================================== +# SEARCH FOR VALIDATED COMPONENTS +foreach (pcomp IN LISTS PIO_FIND_VALID_COMPONENTS) + + # If not found already, search... + if (NOT PIO_${pcomp}_FOUND) + + # Manually add the MPI include and library dirs to search paths + # and search for the package component + if (MPI_${pcomp}_FOUND) + initialize_paths (PIO_${pcomp}_PATHS + INCLUDE_DIRECTORIES ${MPI_${pcomp}_INCLUDE_PATH} + LIBRARIES ${MPI_${pcomp}_LIBRARIES}) + find_package_component(PIO COMPONENT ${pcomp} + PATHS ${PIO_${pcomp}_PATHS}) + else () + find_package_component(PIO COMPONENT ${pcomp} HINT PIO_${pcomp}_PATH=${PIO_PATH}) + endif () + + # Continue only if component found + if (PIO_${pcomp}_FOUND) + + # Checks + if (pcomp STREQUAL C) + + # Check version + check_version (PIO + NAME "pio_meta.h" + HINTS ${PIO_C_INCLUDE_DIRS} + MACRO_REGEX "PIO_VERSION_") + + endif () + + # Dependencies + if (pcomp STREQUAL C AND NOT PIO_C_IS_SHARED) + + # DEPENDENCY: PnetCDF (if PnetCDF enabled) + check_macro (PIO_HAS_PNETCDF + NAME TryPIO_PNETCDF.c + HINTS ${CMAKE_MODULE_PATH} + DEFINITIONS -I${PIO_C_INCLUDE_DIR} + COMMENT "whether PIO has PnetCDF support") + if (PIO_HAS_PNETCDF) + find_package (PnetCDF COMPONENTS C) + endif () + + + elseif (pcomp STREQUAL Fortran AND NOT PIO_Fortran_IS_SHARED) + + # DEPENDENCY: PIO + set (orig_comp ${pcomp}) + set (orig_comps ${PIO_FIND_VALID_COMPONENTS}) + find_package (PIO COMPONENTS C) + set (PIO_FIND_VALID_COMPONENTS ${orig_comps}) + set (pcomp ${orig_comp}) + if (PIO_C_FOUND) + list (APPEND PIO_Fortran_INCLUDE_DIRS ${PIO_C_INCLUDE_DIRS}) + list (APPEND PIO_Fortran_LIBRARIES ${PIO_C_LIBRARIES}) + endif () + + endif () + + endif () + + endif () + +endforeach () +message("PIO_C_FOUND ${PIO_C_FOUND}") +message("PIO_Fortran_FOUND ${PIO_Fortran_FOUND}") +message("PIO_Fortran_INCLUDE_DIR ${PIO_Fortran_INCLUDE_DIR}") diff --git a/cmake/LibCheck.cmake b/cmake/LibCheck.cmake new file mode 100644 index 000000000..3f12bdf79 --- /dev/null +++ b/cmake/LibCheck.cmake @@ -0,0 +1,104 @@ +include (CMakeParseArguments) +include (CheckFunctionExists) +#============================================================================== +# +# FUNCTIONS TO HELP WITH Check* MODULES +# +#============================================================================== + +#______________________________________________________________________________ +# - Basic function to check a property of a package using a try_compile step +# +# SYNTAX: check_macro ( +# NAME +# HINTS ... +# DEFINITIONS ... +# COMMENT ) +# +function (check_macro VARIABLE) + + # Parse the input arguments + set (oneValueArgs COMMENT NAME) + set (multiValueArgs HINTS DEFINITIONS) + cmake_parse_arguments (${VARIABLE} "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + # If the return variable is defined, already, don't continue + if (NOT DEFINED ${VARIABLE}) + + message (STATUS "Checking ${${VARIABLE}_COMMENT}") + find_file (${VARIABLE}_TRY_FILE + NAMES ${${VARIABLE}_NAME} + HINTS ${${VARIABLE}_HINTS}) + if (${VARIABLE}_TRY_FILE) + try_compile (COMPILE_RESULT + ${CMAKE_CURRENT_BINARY_DIR}/try${VARIABLE} + SOURCES ${${VARIABLE}_TRY_FILE} + COMPILE_DEFINITIONS ${${VARIABLE}_DEFINITIONS} + OUTPUT_VARIABLE TryOUT) + if (COMPILE_RESULT) + message (STATUS "Checking ${${VARIABLE}_COMMENT} - yes") + else () + message (STATUS "Checking ${${VARIABLE}_COMMENT} - no") + endif () + + set (${VARIABLE} ${COMPILE_RESULT} + CACHE BOOL "${${VARIABLE}_COMMENT}") + + else () + message (STATUS "Checking ${${VARIABLE}_COMMENT} - failed") + endif () + + unset (${VARIABLE}_TRY_FILE CACHE) + endif () + +endfunction () + +#______________________________________________________________________________ +# - Basic function to check the version of a package using a try_run step +# +# SYNTAX: check_version ( +# NAME +# HINTS ... +# DEFINITIONS ...) +# +function (check_version PKG) + + # Parse the input arguments + set (oneValueArgs NAME MACRO_REGEX) + set (multiValueArgs HINTS) + cmake_parse_arguments (${PKG} "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + # If the return variable is defined, already, don't continue + if (NOT DEFINED ${PKG}_VERSION) + + message (STATUS "Checking ${PKG} version") + find_file (${PKG}_VERSION_HEADER + NAMES ${${PKG}_NAME} + HINTS ${${PKG}_HINTS}) + if (${PKG}_VERSION_HEADER) + set (def) + file (STRINGS ${${PKG}_VERSION_HEADER} deflines + REGEX "^#define[ \\t]+${${PKG}_MACRO_REGEX}") + foreach (defline IN LISTS deflines) + string (REPLACE "\"" "" defline "${defline}") + string (REPLACE "." "" defline "${defline}") + string (REGEX REPLACE "[ \\t]+" ";" deflist "${defline}") + list (GET deflist 2 arg) + list (APPEND def ${arg}) + endforeach () + string (REPLACE ";" "." vers "${def}") + message (STATUS "Checking ${PKG} version - ${vers}") + set (${PKG}_VERSION ${vers} + CACHE STRING "${PKG} version string") + if (${PKG}_VERSION VERSION_LESS ${PKG}_FIND_VERSION}) + message (FATAL_ERROR "${PKG} version insufficient") + endif () + else () + message (STATUS "Checking ${PKG} version - failed") + endif () + + unset (${PKG}_VERSION_HEADER CACHE) + + endif () + +endfunction () \ No newline at end of file diff --git a/cmake/LibFind.cmake b/cmake/LibFind.cmake new file mode 100644 index 000000000..61cd93aa3 --- /dev/null +++ b/cmake/LibFind.cmake @@ -0,0 +1,333 @@ +include (CMakeParseArguments) +include(FindPackageHandleStandardArgs) + +#============================================================================== +# +# FUNCTIONS TO HELP WITH Find* MODULES +# +#============================================================================== + +#______________________________________________________________________________ +# - Wrapper for finding static libraries ONLY +# +macro (find_static_library) + set (_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) + find_library(${ARGN}) + set (CMAKE_FIND_LIBRARY_SUFFIXES ${_CMAKE_FIND_LIBRARY_SUFFIXES}) + unset (_CMAKE_FIND_LIBRARY_SUFFIXES) +endmacro () + + +#______________________________________________________________________________ +# - Wrapper for finding shared/dynamic libraries ONLY +# +macro (find_shared_library) + set (_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) + find_library(${ARGN}) + set (CMAKE_FIND_LIBRARY_SUFFIXES ${_CMAKE_FIND_LIBRARY_SUFFIXES}) + unset (_CMAKE_FIND_LIBRARY_SUFFIXES) +endmacro () + + +#______________________________________________________________________________ +# - Function to determine type (SHARED or STATIC) of library +# +# Input: +# LIB (FILE) +# +# Returns: +# RETURN_VAR (BOOL) +# +function (is_shared_library RETURN_VAR LIB) + get_filename_component(libext ${LIB} EXT) + if (libext MATCHES ${CMAKE_SHARED_LIBRARY_SUFFIX}) + set (${RETURN_VAR} TRUE PARENT_SCOPE) + else () + set (${RETURN_VAR} FALSE PARENT_SCOPE) + endif () +endfunction () + + +#______________________________________________________________________________ +# - Function to define a valid package component +# +# Input: +# ${PKG}_DEFAULT (BOOL) +# ${PKG}_COMPONENT (STRING) +# ${PKG}_INCLUDE_NAMES (LIST) +# ${PKG}_LIBRARY_NAMES (LIST) +# +# Returns: +# ${PKG}_DEFAULT_COMPONENT (STRING) +# ${PKG}_VALID_COMPONENTS (LIST) +# ${PKG}_${COMPONENT}_INCLUDE_NAMES (LIST) +# ${PKG}_${COMPONENT}_LIBRARY_NAMES (LIST) +# +function (define_package_component PKG) + + # Parse the input arguments + set (options DEFAULT) + set (oneValueArgs COMPONENT) + set (multiValueArgs INCLUDE_NAMES LIBRARY_NAMES) + cmake_parse_arguments (${PKG} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if (${PKG}_COMPONENT) + set (PKGCOMP ${PKG}_${${PKG}_COMPONENT}) + else () + set (PKGCOMP ${PKG}) + endif () + + # Set return values + if (${PKG}_COMPONENT) + if (${PKG}_DEFAULT) + set (${PKG}_DEFAULT_COMPONENT ${${PKG}_COMPONENT} PARENT_SCOPE) + endif () + set (VALID_COMPONENTS ${${PKG}_VALID_COMPONENTS}) + list (APPEND VALID_COMPONENTS ${${PKG}_COMPONENT}) + set (${PKG}_VALID_COMPONENTS ${VALID_COMPONENTS} PARENT_SCOPE) + endif () + set (${PKGCOMP}_INCLUDE_NAMES ${${PKG}_INCLUDE_NAMES} PARENT_SCOPE) + set (${PKGCOMP}_LIBRARY_NAMES ${${PKG}_LIBRARY_NAMES} PARENT_SCOPE) + +endfunction () + + +#______________________________________________________________________________ +# - Function to find valid package components +# +# Assumes pre-defined variables: +# ${PKG}_FIND_COMPONENTS (LIST) +# ${PKG}_DEFAULT_COMPONENT (STRING) +# ${PKG}_VALID_COMPONENTS (LIST) +# +# Returns: +# ${PKG}_FIND_VALID_COMPONENTS (LIST) +# +function (find_valid_components PKG) + + if (NOT ${PKG}_FIND_COMPONENTS) + set (${PKG}_FIND_COMPONENTS ${${PKG}_DEFAULT_COMPONENT}) + endif () + + set (FIND_VALID_COMPONENTS) + foreach (comp IN LISTS ${PKG}_FIND_COMPONENTS) + if (";${${PKG}_VALID_COMPONENTS};" MATCHES ";${comp};") + list (APPEND FIND_VALID_COMPONENTS ${comp}) + endif () + endforeach () + + set (${PKG}_FIND_VALID_COMPONENTS ${FIND_VALID_COMPONENTS} PARENT_SCOPE) + +endfunction () + + +#______________________________________________________________________________ +# - Initialize a list of paths from a list of includes and libraries +# +# Input: +# INCLUDE_DIRECTORIES +# LIBRARIES +# +# Ouput: +# ${PATHLIST} +# +function (initialize_paths PATHLIST) + + # Parse the input arguments + set (multiValueArgs INCLUDE_DIRECTORIES LIBRARIES) + cmake_parse_arguments (INIT "" "" "${multiValueArgs}" ${ARGN}) + + set (paths) + foreach (inc IN LISTS INIT_INCLUDE_DIRECTORIES) + list (APPEND paths ${inc}) + get_filename_component (dname ${inc} NAME) + if (dname MATCHES "include") + get_filename_component (prefx ${inc} PATH) + list (APPEND paths ${prefx}) + endif () + endforeach () + foreach (lib IN LISTS INIT_LIBRARIES) + get_filename_component (libdir ${lib} PATH) + list (APPEND paths ${libdir}) + get_filename_component (dname ${libdir} PATH) + if (dname MATCHES "lib") + get_filename_component (prefx ${libdir} PATH) + list (APPEND paths ${prefx}) + endif () + endforeach () + + set (${PATHLIST} ${paths} PARENT_SCOPE) + +endfunction () + + +#______________________________________________________________________________ +# - Basic find package macro for a specific component +# +# Assumes pre-defined variables: +# ${PKG}_${COMP}_INCLUDE_NAMES or ${PKG}_INCLUDE_NAMES +# ${PKG}_${COMP}_LIBRARY_NAMES or ${PKG}_LIBRARY_NAMES +# +# Input: +# ${PKG}_COMPONENT +# ${PKG}_HINTS +# ${PKG}_PATHS +# +function (find_package_component PKG) + + # Parse the input arguments + set (options) + set (oneValueArgs COMPONENT) + set (multiValueArgs HINTS PATHS) + cmake_parse_arguments (${PKG} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set (COMP ${${PKG}_COMPONENT}) + if (COMP) + set (PKGCOMP ${PKG}_${COMP}) + else () + set (PKGCOMP ${PKG}) + endif () + string (TOUPPER ${PKG} PKGUP) + string (TOUPPER ${PKGCOMP} PKGCOMPUP) + + # Only continue if package not found already + if (NOT ${PKGCOMP}_FOUND) + + # Handle QUIET and REQUIRED arguments + if (${${PKG}_FIND_QUIETLY}) + set (${PKGCOMP}_FIND_QUIETLY TRUE) + endif () + if (${${PKG}_FIND_REQUIRED}) + set (${PKGCOMP}_FIND_REQUIRED TRUE) + endif () + + # Determine search order + set (SEARCH_DIRS) + if (${PKG}_HINTS) + list (APPEND SEARCH_DIRS ${${PKG}_HINTS}) + endif () + if (${PKGCOMP}_PATH) + list (APPEND SEARCH_DIRS ${${PKGCOMP}_PATH}) + endif () + if (${PKG}_PATH) + list (APPEND SEARCH_DIRS ${${PKG}_PATH}) + endif () + if (DEFINED ENV{${PKGCOMPUP}}) + list (APPEND SEARCH_DIRS $ENV{${PKGCOMPUP}}) + endif () + if (DEFINED ENV{${PKGUP}}) + list (APPEND SEARCH_DIRS $ENV{${PKGUP}}) + endif () + if (CMAKE_SYSTEM_PREFIX_PATH) + list (APPEND SEARCH_DIRS ${CMAKE_SYSTEM_PREFIX_PATH}) + endif () + if (${PKG}_PATHS) + list (APPEND SEARCH_DIRS ${${PKG}_PATHS}) + endif () + + # Start the search for the include file and library file. Only overload + # if the variable is not defined. + foreach (suffix PREFIX LIBRARY INCLUDE_DIR) + if (NOT DEFINED ${PKGCOMP}_${suffix}) + set (${PKGCOMP}_${suffix} ${PKGCOMP}_${suffix}-NOTFOUND) + endif () + endforeach () + + foreach (dir IN LISTS SEARCH_DIRS) + + # Search for include file names in current dirrectory + foreach (iname IN LISTS ${PKGCOMP}_INCLUDE_NAMES) + if (EXISTS ${dir}/${iname}) + set (${PKGCOMP}_PREFIX ${dir}) + set (${PKGCOMP}_INCLUDE_DIR ${dir}) + break () + endif () + if (EXISTS ${dir}/include/${iname}) + set (${PKGCOMP}_PREFIX ${dir}) + set (${PKGCOMP}_INCLUDE_DIR ${dir}/include) + break () + endif () + endforeach () + + # Search for library file names in the found prefix only! + if (${PKGCOMP}_PREFIX) + find_library (${PKGCOMP}_LIBRARY + NAMES ${${PKGCOMP}_LIBRARY_NAMES} + PATHS ${${PKGCOMP}_PREFIX} + PATH_SUFFIXES lib + NO_DEFAULT_PATH) + + # If found, check if library is static or dynamic + if (${PKGCOMP}_LIBRARY) + is_shared_library (${PKGCOMP}_IS_SHARED ${${PKGCOMP}_LIBRARY}) + + # If we want only shared libraries, and it isn't shared... + if (PREFER_SHARED AND NOT ${PKGCOMP}_IS_SHARED) + find_shared_library (${PKGCOMP}_SHARED_LIBRARY + NAMES ${${PKGCOMP}_LIBRARY_NAMES} + PATHS ${${PKGCOMP}_PREFIX} + PATH_SUFFIXES lib + NO_DEFAULT_PATH) + if (${PKGCOMP}_SHARED_LIBRARY) + set (${PKGCOMP}_LIBRARY ${${PKGCOMP}_SHARED_LIBRARY}) + set (${PKGCOMP}_IS_SHARED TRUE) + endif () + + # If we want only static libraries, and it is shared... + elseif (PREFER_STATIC AND ${PKGCOMP}_IS_SHARED) + find_static_library (${PKGCOMP}_STATIC_LIBRARY + NAMES ${${PKGCOMP}_LIBRARY_NAMES} + PATHS ${${PKGCOMP}_PREFIX} + PATH_SUFFIXES lib + NO_DEFAULT_PATH) + if (${PKGCOMP}_STATIC_LIBRARY) + set (${PKGCOMP}_LIBRARY ${${PKGCOMP}_STATIC_LIBRARY}) + set (${PKGCOMP}_IS_SHARED FALSE) + endif () + endif () + endif () + + # If include dir and library both found, then we're done + if (${PKGCOMP}_INCLUDE_DIR AND ${PKGCOMP}_LIBRARY) + break () + + # Otherwise, reset the search variables and continue + else () + set (${PKGCOMP}_PREFIX ${PKGCOMP}_PREFIX-NOTFOUND) + set (${PKGCOMP}_INCLUDE_DIR ${PKGCOMP}_INCLUDE_DIR-NOTFOUND) + set (${PKGCOMP}_LIBRARY ${PKGCOMP}_LIBRARY-NOTFOUND) + endif () + endif () + + endforeach () + + # handle the QUIETLY and REQUIRED arguments and + # set NetCDF_C_FOUND to TRUE if all listed variables are TRUE + find_package_handle_standard_args (${PKGCOMP} DEFAULT_MSG + ${PKGCOMP}_LIBRARY + ${PKGCOMP}_INCLUDE_DIR) + mark_as_advanced (${PKGCOMP}_INCLUDE_DIR ${PKGCOMP}_LIBRARY) + + # HACK For bug in CMake v3.0: + set (${PKGCOMP}_FOUND ${${PKGCOMPUP}_FOUND}) + + # Set return variables + if (${PKGCOMP}_FOUND) + set (${PKGCOMP}_INCLUDE_DIRS ${${PKGCOMP}_INCLUDE_DIR}) + set (${PKGCOMP}_LIBRARIES ${${PKGCOMP}_LIBRARY}) + endif () + + # Set variables in parent scope + set (${PKGCOMP}_FOUND ${${PKGCOMP}_FOUND} PARENT_SCOPE) + set (${PKGCOMP}_INCLUDE_DIR ${${PKGCOMP}_INCLUDE_DIR} PARENT_SCOPE) + set (${PKGCOMP}_INCLUDE_DIRS ${${PKGCOMP}_INCLUDE_DIRS} PARENT_SCOPE) + set (${PKGCOMP}_LIBRARY ${${PKGCOMP}_LIBRARY} PARENT_SCOPE) + set (${PKGCOMP}_LIBRARIES ${${PKGCOMP}_LIBRARIES} PARENT_SCOPE) + set (${PKGCOMP}_IS_SHARED ${${PKGCOMP}_IS_SHARED} PARENT_SCOPE) + + endif () + +endfunction () + + + diff --git a/datm/CMakeLists.txt b/datm/CMakeLists.txt index 61785d7d1..a39d02e23 100644 --- a/datm/CMakeLists.txt +++ b/datm/CMakeLists.txt @@ -12,4 +12,4 @@ target_include_directories (datm PUBLIC "${CMAKE_BINARY_DIR}/dshr") target_include_directories (datm PUBLIC "${CMAKE_SOURCE_DIR}") target_include_directories (datm PUBLIC "${CMAKE_BINARY_DIR}/share") target_include_directories (datm PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (datm PUBLIC "${PIO_INCDIR}") +target_include_directories (datm PUBLIC "${PIO_Fortran_INCLUDE_DIR}") diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index f2ad7af19..0b0103807 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -26,8 +26,6 @@ module atm_comp_nuopc use dshr_mod , only : dshr_orbital_init, dshr_orbital_update use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize - use perf_mod , only : t_startf, t_stopf, t_barrierf - use datm_datamode_core2_mod , only : datm_datamode_core2_advertise use datm_datamode_core2_mod , only : datm_datamode_core2_init_pointers use datm_datamode_core2_mod , only : datm_datamode_core2_advance @@ -94,8 +92,9 @@ module atm_comp_nuopc logical :: flds_presaero = .false. ! true => send valid prescribe aero fields to mediator logical :: flds_co2 = .false. ! true => send prescribed co2 to mediator logical :: flds_wiso = .false. ! true => send water isotopes to mediator - character(CL) :: bias_correct = nullstr ! send bias correction fields to coupler (not used here) - character(CL) :: anomaly_forcing(8) = nullstr ! send anomaly forcing fields to coupler (not used here) + character(CL) :: bias_correct = nullstr ! send bias correction fields to coupler + character(CL) :: anomaly_forcing(8) = nullstr ! send anomaly forcing fields to coupler + character(CL) :: restfilm = nullstr ! model restart file namelist integer :: nx_global ! global nx integer :: ny_global ! global ny @@ -179,7 +178,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - character(len=CL) :: cvalue ! temporary integer :: nu ! unit number integer :: ierr ! error code logical :: exists ! check for file existence @@ -332,8 +330,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer(i8) :: stepno ! step number real(r8) :: nextsw_cday ! calendar of next atm sw character(CL) :: cvalue ! character string for input config - real(R8) :: orbEccen ! orb eccentricity (unit-less) - real(R8) :: orbMvelpp ! orb moving vernal eq (radians) + real(R8) :: orbEccen ! orb eccentricity (unist-less) + real(R8) :: orbMvelpp ! orb moving vernal eqa (radians) real(R8) :: orbLambm0 ! orb mean long of perhelion (radians) real(R8) :: orbObliqr ! orb obliquity (radians) logical :: isPresent, isSet @@ -344,7 +342,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) ! Initialize mesh, restart flag, compid, and logunit - call t_startf('datm_strdata_init') + call ESMF_TraceRegionEnter('datm_strdata_init') call dshr_mesh_init(gcomp, nullstr, logunit, 'ATM', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) @@ -354,7 +352,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) xmlfilename = 'datm.streams'//trim(inst_suffix)//'.xml' call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'ATM', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('datm_strdata_init') + call ESMF_TraceRegionExit('datm_strdata_init') ! NUOPC_Realize "realizes" a previously advertised field in the importState and exportState ! by replacing the advertised fields with the newly created fields of the same name. @@ -419,7 +417,6 @@ subroutine ModelAdvance(gcomp, rc) ! local variables type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock - type(ESMF_Time) :: time type(ESMF_Alarm) :: alarm type(ESMF_Time) :: currTime type(ESMF_Time) :: nextTime @@ -434,13 +431,12 @@ subroutine ModelAdvance(gcomp, rc) real(R8) :: orbMvelpp ! orb moving vernal eq (radians) real(R8) :: orbLambm0 ! orb mean long of perhelion (radians) real(R8) :: orbObliqr ! orb obliquity (radians) - character(len=CL) :: cvalue ! temporary character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - call t_startf(subname) + call ESMF_TraceRegionEnter(subname) call memcheck(subname, 5, my_task==master_task) ! Query the Component for its clock, importState and exportState @@ -475,11 +471,11 @@ subroutine ModelAdvance(gcomp, rc) endif ! Run datm - call t_startf('datm_run') + call ESMF_TraceRegionEnter('datm_run') call datm_comp_run(importstate, exportstate, next_ymd, next_tod, mon, & orbEccen, orbMvelpp, orbLambm0, orbObliqr, restart_write, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('datm_run') + call ESMF_TraceRegionExit('datm_run') ! Update nextsw_cday for scalar data ! Use nextYMD and nextTOD here since since the component - clock is advance at the END of the time interval @@ -487,7 +483,7 @@ subroutine ModelAdvance(gcomp, rc) call dshr_state_SetScalar(nextsw_cday, flds_scalar_index_nextsw_cday, exportState, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf(subname) + call ESMF_TraceRegionExit(subname) end subroutine ModelAdvance @@ -519,7 +515,7 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe rc = ESMF_SUCCESS - call t_startf('DATM_RUN') + call ESMF_TraceRegionEnter('DATM_RUN') !-------------------- ! First time initialization @@ -573,32 +569,30 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe call shr_strdata_setOrbs(sdat, orbEccen, orbMvelpp, orbLambm0, orbObliqr, idt) ! time and spatially interpolate to model time and grid - call t_barrierf('datm_BARRIER',mpicom) - call t_startf('datm_strdata_advance') + call ESMF_TraceRegionEnter('datm_strdata_advance') call shr_strdata_advance(sdat, target_ymd, target_tod, logunit, 'datm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('datm_strdata_advance') + call ESMF_TraceRegionExit('datm_strdata_advance') ! copy all fields from streams to export state as default ! This automatically will update the fields in the export state - call t_barrierf('datm_comp_dfield_copy_BARRIER', mpicom) - call t_startf('datm_dfield_copy') + call ESMF_TraceRegionEnter('datm_dfield_copy') call dshr_dfield_copy(dfields, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('datm_dfield_copy') + call ESMF_TraceRegionExit('datm_dfield_copy') ! Determine data model behavior based on the mode - call t_startf('datm_datamode') + call ESMF_TraceRegionEnter('datm_datamode') select case (trim(datamode)) case('CORE2_NYF','CORE2_IAF') - call datm_datamode_core2_advance(exportstate, datamode, target_ymd, target_tod, target_mon, & - sdat%model_calendar, factorfn_mesh, factorfn_data, rc) + call datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_mon, & + sdat%model_calendar, factorfn_mesh, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CORE_IAF_JRA') call datm_datamode_jra_advance(exportstate, target_ymd, target_tod, sdat%model_calendar, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CLMNCEP') - call datm_datamode_clmncep_advance(importstate, exportstate, masterproc, logunit, mpicom, rc) + call datm_datamode_clmncep_advance(masterproc, logunit, mpicom, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('ERA5') call datm_datamode_era5_advance(exportstate, masterproc, logunit, mpicom, target_ymd, & @@ -611,19 +605,19 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe select case (trim(datamode)) case('CORE2_NYF','CORE2_IAF') call datm_datamode_core2_restart_write(case_name, inst_suffix, target_ymd, target_tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CORE_IAF_JRA') call datm_datamode_jra_restart_write(case_name, inst_suffix, target_ymd, target_tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CLMNCEP') call datm_datamode_clmncep_restart_write(case_name, inst_suffix, target_ymd, target_tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) if (ChkErr(rc,__LINE__,u_FILE_u)) return case('ERA5') call datm_datamode_era5_restart_write(case_name, inst_suffix, target_ymd, target_tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) if (ChkErr(rc,__LINE__,u_FILE_u)) return end select end if @@ -637,8 +631,8 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - call t_stopf('datm_datamode') - call t_stopf('DATM_RUN') + call ESMF_TraceRegionExit('datm_datamode') + call ESMF_TraceRegionExit('DATM_RUN') !-------- contains @@ -739,7 +733,6 @@ real(R8) function getNextRadCDay( ymd, tod, stepno, dtime, iradsw, calendar ) real(R8) :: nextsw_cday real(R8) :: julday integer :: liradsw - integer :: yy,mm,dd character(*),parameter :: subName = '(getNextRadCDay) ' !------------------------------------------------------------------------------- diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index 39ff3a179..ebfde5be8 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -1,6 +1,6 @@ #!/usr/bin/env python -"""Namelist creator for CIME's data atmosphere model. +"""Namelist creator for CDEPS data atm model. """ # Typically ignore this. @@ -11,8 +11,13 @@ import os, sys -_CIMEROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..","..","..","..","..") -sys.path.append(os.path.join(_CIMEROOT, "scripts", "Tools")) +_CDEPS_CONFIG = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,os.pardir,"cime_config") +_CIMEROOT = os.environ.get("CIMEROOT") +if _CIMEROOT is None: + raise SystemExit("ERROR: must set CIMEROOT environment variable") +_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") +sys.path.append(_LIBDIR) +sys.path.append(_CDEPS_CONFIG) from standard_script_setup import * from CIME.case import Case @@ -20,6 +25,7 @@ from CIME.nmlgen import NamelistGenerator from CIME.utils import expect, get_model, safe_copy from CIME.buildnml import create_namelist_infile, parse_input, copy_inputs_to_rundir from CIME.XML.files import Files +from stream_cdeps import StreamCDEPS logger = logging.getLogger(__name__) @@ -45,7 +51,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path datm_presaero = case.get_value("DATM_PRESAERO") datm_co2_tseries = case.get_value("DATM_CO2_TSERIES") atm_grid = case.get_value("ATM_GRID") - grid = case.get_value("GRID") + model_grid = case.get_value("GRID") comp_lnd = case.get_value("COMP_LND") # Check for incompatible options. @@ -63,8 +69,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path # Initialize namelist defaults config = {} - config['grid'] = grid - config['atm_grid'] = atm_grid + config['model_grid'] = model_grid config['datm_mode'] = datm_mode config['datm_co2_tseries'] = datm_co2_tseries config['datm_presaero'] = datm_presaero @@ -78,20 +83,30 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path namelist_file = os.path.join(confdir, "datm_in") nmlgen.write_output_file(namelist_file, data_list_path, groups=['datm_nml']) - # Generate datm.streams.xml - streams = nmlgen.get_streams() + # Determine streams + streamlist = nmlgen.get_streams() + if type(streamlist) == type(str()): + streamlist = [] + if datm_presaero != "none": - streams.append("presaero.{}".format(datm_presaero)) + streamlist.append("presaero.{}".format(datm_presaero)) if datm_topo != "none": - streams.append("topo.{}".format(datm_topo)) + streamlist.append("topo.{}".format(datm_topo)) if datm_co2_tseries != "none": - streams.append("co2tseries.{}".format(datm_co2_tseries)) + streamlist.append("co2tseries.{}".format(datm_co2_tseries)) bias_correct = nmlgen.get_value("bias_correct") - streams.append(bias_correct) + if bias_correct is not None: + streamlist.append(bias_correct) anomaly_forcing = nmlgen.get_value("anomaly_forcing") - streams += anomaly_forcing - stream_path = os.path.join(confdir, "datm.streams"+inst_string+".xml" ) - nmlgen.create_nuopc_stream_files(config, caseroot, streams, stream_path, data_list_path) + if anomaly_forcing[0] is not None: + streamlist += anomaly_forcing + + # Generate datm.streams.xml + stream_file = os.path.join(_CDEPS_CONFIG,os.pardir, "datm","cime_config","stream_definition_datm.xml") + schema_file = os.path.join(_CDEPS_CONFIG,"streams_v2.0.xsd") + streams = StreamCDEPS(stream_file, schema_file) + outfile = os.path.join(confdir, "datm.streams"+inst_string+".xml" ) + streams.create_stream_xml(streamlist, case, outfile, data_list_path) ############################################################################### def buildnml(case, caseroot, compname): diff --git a/datm/cime_config/config_component.xml b/datm/cime_config/config_component.xml index 8fe46cf50..59f5aef4b 100644 --- a/datm/cime_config/config_component.xml +++ b/datm/cime_config/config_component.xml @@ -117,8 +117,8 @@ SSP5-8.5 20tr 20tr - omip - omip + omip.iaf + omip.jra run_component_datm env_run.xml diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index 479c5587b..a8c420889 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -4,208 +4,14 @@ - - - - - + + char(100) streams streams_file - List of streams used for the given datm_mode + List of streams used for the given DATM_MODE CLM_QIAN.Solar,CLM_QIAN.Precip,CLM_QIAN.TPQW @@ -214,2343 +20,45 @@ CLM_QIAN_WISO.Solar,CLM_QIAN_WISO.Precip,CLM_QIAN_WISO.TPQW - CLMCRUNCEPv7.Solar,CLMCRUNCEPv7.Precip,CLMCRUNCEPv7.TPQW + CLMCRUNCEPv7.Solar,CLMCRUNCEPv7.Precip,CLMCRUNCEPv7.TPQW - CLMGSWP3v1.Solar,CLMGSWP3v1.Precip,CLMGSWP3v1.TPQW + CLMGSWP3v1.Solar,CLMGSWP3v1.Precip,CLMGSWP3v1.TPQW - CLMNLDAS2.Solar,CLMNLDAS2.Precip,CLMNLDAS2.TPQW + CLMNLDAS2.Solar,CLMNLDAS2.Precip,CLMNLDAS2.TPQW - - 1PT + + 1PT.mexicocityMEX + + + 1PT.vancouverCAN + + + 1PT.urbanc_alpha - CORE2_NYF.GISS,CORE2_NYF.GXGXS,CORE2_NYF.NCEP + CORE2_NYF.GISS,CORE2_NYF.GXGXS,CORE2_NYF.NCEP - CORE2_IAF.GCGCS.PREC,CORE2_IAF.GISS.LWDN,CORE2_IAF.GISS.SWDN,CORE2_IAF.GISS.SWUP,CORE2_IAF.NCEP.DN10,CORE2_IAF.NCEP.Q_10,CORE2_IAF.NCEP.SLP_,CORE2_IAF.NCEP.T_10,CORE2_IAF.NCEP.U_10,CORE2_IAF.NCEP.V_10,CORE2_IAF.CORE2.ArcFactor + CORE2_IAF.GCGCS.PREC,CORE2_IAF.GISS.LWDN,CORE2_IAF.GISS.SWDN,CORE2_IAF.GISS.SWUP,CORE2_IAF.NCEP.DN10,CORE2_IAF.NCEP.Q_10,CORE2_IAF.NCEP.SLP_,CORE2_IAF.NCEP.T_10,CORE2_IAF.NCEP.U_10,CORE2_IAF.NCEP.V_10,CORE2_IAF.CORE2.ArcFactor - CORE_IAF_JRA.PREC,CORE_IAF_JRA.LWDN,CORE_IAF_JRA.SWDN,CORE_IAF_JRA.Q_10,CORE_IAF_JRA.SLP_,CORE_IAF_JRA.T_10,CORE_IAF_JRA.U_10,CORE_IAF_JRA.V_10,CORE_IAF_JRA.CORE2.ArcFactor + CORE_IAF_JRA.PREC,CORE_IAF_JRA.LWDN,CORE_IAF_JRA.SWDN,CORE_IAF_JRA.Q_10,CORE_IAF_JRA.SLP_,CORE_IAF_JRA.T_10,CORE_IAF_JRA.U_10,CORE_IAF_JRA.V_10,CORE_IAF_JRA.CORE2.ArcFactor CORE_IAF_JRA_1p4_2018.GCGCS.PREC,CORE_IAF_JRA_1p4_2018.GISS.LWDN,CORE_IAF_JRA_1p4_2018.GISS.SWDN,CORE_IAF_JRA_1p4_2018.NCEP.Q_10,CORE_IAF_JRA_1p4_2018.NCEP.SLP_,CORE_IAF_JRA_1p4_2018.NCEP.T_10,CORE_IAF_JRA_1p4_2018.NCEP.U_10,CORE_IAF_JRA_1p4_2018.NCEP.V_10 - - CORE2_IAF.NCEP.DENS.SOFS,CORE2_IAF.NCEP.PSLV.SOFS,CORE2_IAF.PREC.SOFS.DAILY,CORE2_IAF.LWDN.SOFS.DAILY,CORE2_IAF.SWDN.SOFS.DAILY,CORE2_IAF.SWUP.SOFS.DAILY,CORE2_IAF.SHUM.SOFS.6HOUR,CORE2_IAF.TBOT.SOFS.6HOUR,CORE2_IAF.U.SOFS.6HOUR,CORE2_IAF.V.SOFS.6HOUR,CORE2_IAF.CORE2.ArcFactor + + CORE2_IAF.NCEP.DENS.SOFS,CORE2_IAF.NCEP.PSLV.SOFS,CORE2_IAF.PREC.SOFS.DAILY,CORE2_IAF.LWDN.SOFS.DAILY,CORE2_IAF.SWDN.SOFS.DAILY,CORE2_IAF.SWUP.SOFS.DAILY,CORE2_IAF.SHUM.SOFS.6HOUR,CORE2_IAF.TBOT.SOFS.6HOUR,CORE2_IAF.U.SOFS.6HOUR,CORE2_IAF.V.SOFS.6HOUR,CORE2_IAF.CORE2.ArcFactor ERA5_HOURLY - CPLHISTForcing.Solar,CPLHISTForcing.nonSolarFlux,CPLHISTForcing.State3hr,CPLHISTForcing.State1hr - - - - - - char - streams - streams_file - Stream domain file directory. - - - - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc - - - - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc - - - - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.c2016.0.5d.ESMFmesh_260520.nc - - - - - - $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/clmforc.GSWP3.c2011.0.5x0.5.TPQWL.SCRIP.210520_ESMFmesh.nc - - - - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.0.125d.v1.ESMFmesh_120620.nc - - - - - - none - - - - - - - - - - - - - - - - - - $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc - - - - - - $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc - - - none - - - - - - $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc - - - $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - - - - - - $DIN_LOC_ROOT/share/meshes/TL639_200618_ESMFmesh.nc - - - - - - - none - - - - - - $DATM_DOMAIN_MESH - - - $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc - - - - - - $DATM_DOMAIN_MESH - - - $DIN_LOC_ROOT/atm/datm7/topo_forcing/topodata_0.9x1.SCRIP.210520_ESMFmesh.nc - - - - - - char - streams - streams_file - Stream data file path(s). - - null - - - - - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/mexicocityMEX.c080124/clm1pt-1993-12.nc - - - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/vancouverCAN.c080124/clm1pt-1992-08.nc - - - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0001-08.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0001-09.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0001-10.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0001-11.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0001-12.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-01.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-02.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-03.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-04.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-05.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-06.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-07.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-08.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-09.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-10.nc - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-11.nc - - - - - - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1hi.%ym.nc - - - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc - - - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc - - - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1h.%ym.nc - - - - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/Solar6Hrly/clmforc.Qian.c2006.T62.Solr.%ym.nc - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/Precip6Hrly/clmforc.Qian.c2006.T62.Prec.%ym.nc - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/TmpPrsHumWnd3Hrly/clmforc.Qian.c2006.T62.TPQW.%ym.nc - - - - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/Solar6Hrly/clmforc.Qian.c2006.T62.Solr.%ym.nc - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/Precip6Hrly/clmforc.Qian.c2006.T62.Prec.%ym.nc - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/TmpPrsHumWnd3Hrly/clmforc.Qian.c2006.T62.TPQW.%ym.nc - - - - - - $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Solar6Hrly/clmforc.cruncep.V7.c2016.0.5d.Solr.%ym.nc - - - $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Precip6Hrly/clmforc.cruncep.V7.c2016.0.5d.Prec.%ym.nc - - - $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/TPHWL6Hrly/clmforc.cruncep.V7.c2016.0.5d.TPQWL.%ym.nc - - - $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/Solar/clmforc.GSWP3.c2011.0.5x0.5.Solr.%ym.nc - - - $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/Precip/clmforc.GSWP3.c2011.0.5x0.5.Prec.%ym.nc - - - $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/TPHWL/clmforc.GSWP3.c2011.0.5x0.5.TPQWL.%ym.nc - - - - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Solar/ctsmforc.NLDAS2.0.125d.v1.Solr.%ym.nc - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Precip/ctsmforc.NLDAS2.0.125d.v1.Prec.%ym.nc - - - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/TPQWL/ctsmforc.NLDAS2.0.125d.v1.TPQWL.%ym.nc - - - - - - $DIN_LOC_ROOT/atm/datm7/NYF/nyf.giss.T62.051007.nc - - - $DIN_LOC_ROOT/atm/datm7/NYF/nyf.gxgxs.T62.051007.nc - - - $DIN_LOC_ROOT/atm/datm7/NYF/nyf.ncep.T62.050923.nc - - - - - - $DIN_LOC_ROOT/ocn/iaf/ncep.SOFS.2010.nc - - - $DIN_LOC_ROOT/ocn/iaf/ncep.SOFS.2010.nc - - - $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc - - - $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc - - - $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc - - - $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc - - - $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - - - $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - - - $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - - - $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc - - - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1948.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1949.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1950.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1951.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1952.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1953.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1954.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1955.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1956.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1957.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1958.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1959.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1960.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1961.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1962.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1963.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1964.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1965.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1966.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1967.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1968.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1969.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1970.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1971.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1972.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1973.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1974.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1975.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1976.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1977.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1978.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1979.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1980.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1981.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1982.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1983.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1984.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1985.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1986.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1987.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1988.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1989.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1990.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1991.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1992.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1993.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1994.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1995.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1996.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1997.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1998.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.1999.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.2000.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.2001.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.2002.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.2003.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.2004.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.2005.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.2006.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.2007.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.2008.20120412.nc - $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.2009.20120412.nc - - - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1948.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1949.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1950.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1951.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1952.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1953.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1954.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1955.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1956.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1957.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1958.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1959.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1960.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1961.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1962.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1963.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1964.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1965.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1966.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1967.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1968.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1969.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1970.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1971.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1972.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1973.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1974.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1975.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1976.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1977.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1978.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1979.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1980.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1981.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1982.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1983.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1984.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1985.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1986.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1987.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1988.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1989.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1990.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1991.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1992.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1993.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1994.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1995.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1996.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1997.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1998.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.1999.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.2000.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.2001.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.2002.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.2003.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.2004.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.2005.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.2006.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.2007.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.2008.20120412.nc - $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.2009.20120412.nc - - - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1948.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1949.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1950.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1951.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1952.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1953.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1954.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1955.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1956.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1957.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1958.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1959.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1960.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1961.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1962.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1963.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1964.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1965.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1966.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1967.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1968.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1969.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1970.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1971.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1972.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1973.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1974.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1975.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1976.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1977.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1978.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1979.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1980.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1981.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1982.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1983.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1984.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1985.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1986.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1987.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1988.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1989.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1990.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1991.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1992.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1993.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1994.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1995.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1996.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1997.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1998.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.1999.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.2000.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.2001.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.2002.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.2003.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.2004.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.2005.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.2006.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.2007.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.2008.20120412.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.2009.20120412.nc - - - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1948.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1949.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1950.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1951.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1952.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1953.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1954.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1955.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1956.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1957.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1958.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1959.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1960.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1961.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1962.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1963.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1964.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1965.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1966.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1967.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1968.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1969.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1970.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1971.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1972.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1973.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1974.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1975.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1976.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1977.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1978.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1979.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1980.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1981.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1982.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1983.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1984.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1985.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1986.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1987.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1988.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1989.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1990.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1991.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1992.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1993.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1994.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1995.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1996.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1997.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1998.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.1999.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.2000.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.2001.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.2002.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.2003.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.2004.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.2005.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.2006.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.2007.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.2008.20120412.nc - $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.2009.20120412.nc - - - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1948.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1949.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1950.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1951.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1952.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1953.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1954.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1955.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1956.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1957.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1958.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1959.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1960.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1961.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1962.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1963.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1964.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1965.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1966.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1967.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1968.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1969.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1970.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1971.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1972.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1973.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1974.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1975.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1976.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1977.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1978.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1979.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1980.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1981.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1982.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1983.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1984.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1985.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1986.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1987.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1988.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1989.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1990.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1991.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1992.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1993.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1994.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1995.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1996.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1997.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1998.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.1999.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.2000.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.2001.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.2002.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.2003.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.2004.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.2005.20120414.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.2006.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.2007.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.2008.20120412.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.2009.20120412.nc - - - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1948.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1949.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1950.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1951.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1952.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1953.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1954.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1955.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1956.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1957.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1958.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1959.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1960.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1961.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1962.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1963.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1964.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1965.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1966.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1967.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1968.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1969.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1970.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1971.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1972.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1973.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1974.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1975.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1976.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1977.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1978.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1979.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1980.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1981.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1982.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1983.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1984.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1985.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1986.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1987.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1988.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1989.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1990.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1991.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1992.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1993.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1994.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1995.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1996.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1997.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1998.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.1999.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.2000.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.2001.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.2002.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.2003.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.2004.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.2005.20120414.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.2006.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.2007.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.2008.20120412.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.2009.20120412.nc - - - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1948.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1949.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1950.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1951.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1952.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1953.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1954.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1955.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1956.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1957.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1958.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1959.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1960.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1961.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1962.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1963.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1964.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1965.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1966.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1967.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1968.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1969.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1970.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1971.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1972.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1973.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1974.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1975.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1976.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1977.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1978.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1979.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1980.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1981.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1982.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1983.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1984.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1985.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1986.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1987.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1988.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1989.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1990.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1991.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1992.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1993.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1994.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1995.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1996.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1997.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1998.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.1999.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.2000.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.2001.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.2002.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.2003.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.2004.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.2005.20120414.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.2006.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.2007.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.2008.20120412.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.2009.20120412.nc - - - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1948.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1949.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1950.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1951.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1952.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1953.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1954.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1955.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1956.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1957.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1958.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1959.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1960.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1961.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1962.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1963.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1964.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1965.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1966.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1967.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1968.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1969.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1970.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1971.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1972.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1973.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1974.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1975.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1976.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1977.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1978.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1979.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1980.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1981.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1982.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1983.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1984.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1985.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1986.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1987.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1988.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1989.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1990.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1991.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1992.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1993.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1994.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1995.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1996.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1997.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1998.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.1999.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.2000.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.2001.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.2002.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.2003.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.2004.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.2005.20120414.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.2006.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.2007.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.2008.20120412.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.2009.20120412.nc - - - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1948.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1949.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1950.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1951.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1952.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1953.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1954.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1955.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1956.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1957.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1958.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1959.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1960.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1961.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1962.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1963.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1964.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1965.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1966.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1967.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1968.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1969.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1970.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1971.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1972.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1973.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1974.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1975.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1976.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1977.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1978.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1979.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1980.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1981.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1982.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1983.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1984.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1985.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1986.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1987.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1988.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1989.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1990.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1991.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1992.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1993.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1994.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1995.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1996.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1997.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1998.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.1999.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.2000.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.2001.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.2002.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.2003.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.2004.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.2005.20120414.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.2006.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.2007.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.2008.20120412.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.2009.20120412.nc - - - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1948.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1949.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1950.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1951.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1952.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1953.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1954.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1955.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1956.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1957.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1958.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1959.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1960.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1961.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1962.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1963.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1964.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1965.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1966.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1967.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1968.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1969.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1970.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1971.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1972.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1973.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1974.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1975.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1976.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1977.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1978.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1979.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1980.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1981.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1982.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1983.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1984.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1985.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1986.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1987.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1988.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1989.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1990.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1991.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1992.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1993.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1994.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1995.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1996.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1997.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1998.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.1999.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.2000.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.2001.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.2002.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.2003.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.2004.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.2005.20120414.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.2006.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.2007.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.2008.20120412.nc - $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.2009.20120412.nc - - - $DIN_LOC_ROOT/atm/datm7/CORE2/CORE2.t_10.ArcFactor.T62.1997-2004.nc - - - - - - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1958.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1959.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1960.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1961.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1962.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1963.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1964.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1965.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1966.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1967.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1968.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1969.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1970.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1971.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1972.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1973.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1974.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1975.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1976.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1977.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1978.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1979.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1980.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1981.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1982.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1983.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1984.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1985.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1986.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1987.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1988.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1989.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1990.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1991.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1992.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1993.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1994.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1995.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1996.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1997.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1998.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.1999.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2000.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2001.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2002.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2003.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2004.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2005.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2006.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2007.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2008.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2009.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2010.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2011.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2012.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2013.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2014.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2015.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.2016.171019.nc - - - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1958.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1959.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1960.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1961.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1962.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1963.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1964.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1965.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1966.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1967.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1968.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1969.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1970.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1971.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1972.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1973.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1974.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1975.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1976.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1977.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1978.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1979.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1980.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1981.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1982.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1983.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1984.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1985.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1986.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1987.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1988.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1989.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1990.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1991.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1992.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1993.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1994.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1995.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1996.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1997.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1998.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.1999.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2000.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2001.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2002.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2003.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2004.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2005.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2006.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2007.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2008.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2009.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2010.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2011.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2012.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2013.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2014.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2015.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.2016.171019.nc - - - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1958.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1959.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1960.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1961.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1962.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1963.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1964.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1965.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1966.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1967.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1968.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1969.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1970.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1971.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1972.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1973.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1974.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1975.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1976.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1977.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1978.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1979.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1980.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1981.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1982.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1983.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1984.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1985.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1986.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1987.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1988.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1989.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1990.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1991.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1992.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1993.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1994.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1995.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1996.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1997.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1998.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.1999.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2000.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2001.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2002.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2003.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2004.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2005.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2006.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2007.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2008.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2009.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2010.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2011.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2012.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2013.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2014.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2015.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.2016.171019.nc - - - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1958.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1959.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1960.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1961.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1962.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1963.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1964.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1965.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1966.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1967.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1968.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1969.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1970.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1971.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1972.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1973.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1974.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1975.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1976.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1977.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1978.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1979.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1980.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1981.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1982.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1983.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1984.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1985.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1986.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1987.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1988.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1989.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1990.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1991.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1992.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1993.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1994.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1995.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1996.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1997.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1998.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.1999.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2000.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2001.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2002.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2003.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2004.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2005.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2006.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2007.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2008.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2009.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2010.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2011.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2012.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2013.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2014.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2015.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.2016.171019.nc - - - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1958.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1959.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1960.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1961.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1962.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1963.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1964.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1965.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1966.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1967.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1968.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1969.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1970.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1971.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1972.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1973.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1974.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1975.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1976.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1977.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1978.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1979.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1980.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1981.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1982.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1983.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1984.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1985.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1986.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1987.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1988.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1989.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1990.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1991.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1992.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1993.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1994.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1995.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1996.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1997.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1998.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.1999.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2000.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2001.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2002.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2003.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2004.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2005.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2006.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2007.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2008.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2009.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2010.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2011.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2012.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2013.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2014.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2015.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.2016.171019.nc - - - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1958.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1959.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1960.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1961.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1962.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1963.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1964.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1965.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1966.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1967.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1968.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1969.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1970.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1971.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1972.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1973.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1974.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1975.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1976.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1977.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1978.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1979.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1980.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1981.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1982.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1983.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1984.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1985.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1986.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1987.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1988.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1989.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1990.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1991.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1992.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1993.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1994.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1995.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1996.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1997.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1998.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.1999.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2000.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2001.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2002.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2003.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2004.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2005.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2006.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2007.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2008.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2009.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2010.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2011.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2012.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2013.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2014.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2015.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.2016.171019.nc - - - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1958.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1959.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1960.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1961.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1962.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1963.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1964.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1965.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1966.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1967.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1968.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1969.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1970.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1971.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1972.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1973.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1974.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1975.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1976.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1977.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1978.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1979.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1980.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1981.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1982.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1983.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1984.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1985.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1986.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1987.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1988.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1989.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1990.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1991.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1992.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1993.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1994.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1995.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1996.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1997.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1998.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.1999.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2000.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2001.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2002.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2003.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2004.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2005.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2006.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2007.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2008.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2009.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2010.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2011.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2012.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2013.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2014.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2015.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.2016.171019.nc - - - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1958.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1959.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1960.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1961.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1962.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1963.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1964.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1965.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1966.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1967.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1968.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1969.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1970.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1971.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1972.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1973.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1974.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1975.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1976.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1977.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1978.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1979.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1980.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1981.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1982.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1983.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1984.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1985.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1986.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1987.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1988.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1989.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1990.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1991.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1992.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1993.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1994.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1995.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1996.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1997.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1998.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.1999.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2000.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2001.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2002.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2003.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2004.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2005.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2006.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2007.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2008.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2009.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2010.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2011.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2012.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2013.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2014.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2015.171019.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.2016.171019.nc - - - $DIN_LOC_ROOT/atm/datm7/CORE2/CORE2.t_10.ArcFactor.T62.1997-2004.nc - - - - - - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.01.200618.nc - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.02.200618.nc - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.03.200618.nc - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.04.200618.nc - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.05.200618.nc - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.06.200618.nc - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.07.200618.nc - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.08.200618.nc - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.09.200618.nc - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.10.200618.nc - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.11.200618.nc - $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.12.200618.nc - - - - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_global_simyr_1750-2014_CMIP6_c180929.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bands_simyr_1750-2015_CMIP6_c180929.nc - - - fco2_datm_global_ssp585_simyr_1750-2020_CMIP6_c200324.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP1-1.9_simyr_2014-2500_CMIP6_c190514.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP1-2.6__simyr_2014-2500_CMIP6_c190506.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP2-4.5__simyr_2014-2500_CMIP6_c190506.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/co2_datm_lat-bandsSSP3-7.0__simyr_2014-2500_CMIP6_c190506.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP4-3.4_simyr_2014-2500_CMIP6_c190514.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP4-6.0__simyr_2014-2500_CMIP6_c190506.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP5-3.4__simyr_2014-2500_CMIP6_c190506.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP5-8.5__simyr_2014-2500_CMIP6_c190506.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP1-1.9_simyr_2014-2501_CMIP6_c190514.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP1-2.6__simyr_2014-2501_CMIP6_c190506.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP2-4.5__simyr_2014-2501_CMIP6_c190506.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP3-7.0__simyr_2014-2501_CMIP6_c190506.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP4-3.4_simyr_2014-2501_CMIP6_c190514.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP4-6.0__simyr_2014-2501_CMIP6_c190506.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP5-3.4__simyr_2014-2501_CMIP6_c190506.nc - - - $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP5-8.5__simyr_2014-2501_CMIP6_c190506.nc - - - - - - $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/gpcp/qian/bias_correction.Prec.%y.nc - - - $DIN_LOC_ROOT/atm/datm7/clm_output/cruncep_precip_1deg/gpcp_1deg_bias_correction/bias_correction.Prec.%y.nc - - - $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/cmap/cruncep/bias_correction.Prec.%y.nc - - - - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.pr.ccsm4.rcp45.2006-2300.nc - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.tas.ccsm4.rcp45.2006-2300.nc - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.ps.ccsm4.rcp45.2006-2300.nc - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.huss.ccsm4.rcp45.2006-2300.nc - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.uas.ccsm4.rcp45.2006-2300.nc - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.vas.ccsm4.rcp45.2006-2300.nc - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.rsds.ccsm4.rcp45.2006-2300.nc - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.rlds.ccsm4.rcp45.2006-2300.nc - - - - - - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1d.%ym.nc - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP126_b.e21.BSSP126cmip6.f09_g17.CMIP6-SSP1-2.6.001_2014-2101_monthly_0.9x1.25_c190523.nc - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP245_b.e21.BWSSP245cmip6.f09_g17.CMIP6-SSP2-4.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.nc - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_2014-2101_monthly_0.9x1.25_c190402.nc - - - null - - - $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP585_b.e21.BSSP585cmip6.f09_g17.CMIP6-SSP5-8.5.001_2014-2101_monthly_0.9x1.25_c190419.nc - - - - - - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc - - - $DIN_LOC_ROOT/atm/datm7/topo_forcing/topodata_0.9x1.25_USGS_070110_stream_c151201.nc - - - - - - char - streams - streams_file - Stream data variable name(s). - - null - - - - - ZBOT Sa_z - TBOT Sa_tbot - RH Sa_rh - WIND Sa_wind - PSRF Sa_pbot - PRECTmms Faxa_precn - FSDS Faxa_swdn - FSDSdir Faxa_swdndr - FSDSdif Faxa_swdndf - FLDS Faxa_lwdn - - - - - - a2x1hi_Faxa_swndr Faxa_swndr - a2x1hi_Faxa_swvdr Faxa_swvdr - a2x1hi_Faxa_swndf Faxa_swndf - a2x1hi_Faxa_swvdf Faxa_swvdf - - - a2x3h_Faxa_rainc Faxa_rainc - a2x3h_Faxa_rainl Faxa_rainl - a2x3h_Faxa_snowc Faxa_snowc - a2x3h_Faxa_snowl Faxa_snowl - a2x3h_Faxa_lwdn Faxa_lwdn - - - a2x3h_Sa_z Sa_z - a2x3h_Sa_tbot Sa_tbot - a2x3h_Sa_ptem Sa_ptem - a2x3h_Sa_shum Sa_shum - a2x3h_Sa_pbot Sa_pbot - a2x3h_Sa_dens Sa_dens - a2x3h_Sa_pslv Sa_pslv - a2x3h_Sa_co2diag Sa_co2diag - a2x3h_Sa_co2prog Sa_co2prog - - - a2x1h_Sa_u Sa_u - a2x1h_Sa_v Sa_v - - - - - - FSDS Faxa_swdn - - - PRECTmms Faxa_precn - - - TBOT Sa_tbot - WIND Sa_wind - QBOT Sa_shum - PSRF Sa_pbot - - - FSDS Faxaswdn - - - PRECTmms Faxa_precn - - - TBOT Sa_tbot - WIND Sa_wind - QBOT Sa_shum - PSRF Sa_pbot - - - - - - FSDS Faxa_swdn - - - PRECTmms Faxa_precn - - - TBOT Sa_tbot - WIND Sa_wind - QBOT Sa_shum - PSRF Sa_pbot - - - - - - FSDS Faxa_swdn - - - PRECTmms Faxa_precn - - - TBOT Sa_tbot - WIND Sa_wind - QBOT Sa_shum - PSRF Sa_pbot - FLDS Faxa_lwdn - - - - - - FSDS Faxa_swdn - - - PRECTmms Faxa_precn - - - TBOT Sa_tbot - WIND Sa_wind - QBOT Sa_shum - PSRF Sa_pbot - FLDS Faxa_lwdn - - - - - - lwdn Faxa_lwdn - swdn Faxa_swdn - swup Faxa_swup - - - prc Faxa_prec - - - dn10 Sa_dens - slp_ Sa_pslv - q_10 Sa_shum - t_10 Sa_tbot - u_10 Sa_u - v_10 Sa_v - - - - - - dn10 Sa_dens - - - slp_ Sa_pslv - - - t3_5 Sa_tbot - - - u3_5 Sa_u - - - v3_5 Sa_v - - - dn10 Sa_dens - - - q_10 Sa_shum - - - slp_ Sa_pslv - - - t_10 Sa_tbot - - - u_10 Sa_u - - - v_10 Sa_v - - - prec Faxa_prec - - - lwdn Faxa_lwdn - - - swdn Faxa_swdn - - - swup Faxa_swup + CPLHISTForcing.Solar,CPLHISTForcing.nonSolarFlux,CPLHISTForcing.State3hr,CPLHISTForcing.State1hr - - q3_5 Faxa_shum - - - prc Faxa_prec - - - lwdn Faxa_lwdn - - - swdn Faxa_swdn - - - swup Faxa_swup - - - TarcFactor tarcf - - - - - - q_10 Sa_shum - - - slp Sa_pslv - - - t_10 Sa_tbot - - - u_10 Sa_u - - - v_10 Sa_v - - - prec Faxa_prec - - - lwdn Faxa_lwdn - - - swdn Faxa_swdn - - - TarcFactor tarcf - - - - - - u10 Sa_u - v10 Sa_v - t2m Sa_tbot - d2m Sa_tdew - msl Sa_pslv - sp Sa_pbot - tp Faxa_rain - cp Faxa_rainc - lsp Faxa_rainl - csf Faxa_snowc - lsf Faxa_snowl - ssrd Faxa_swdn - strd Faxa_lwdn - aluvp Faxa_swvdr - aluvd Faxa_swvdf - alnip Faxa_swndr - alnid Faxa_swndf - sshf Faxa_sen - slhf Faxa_lat - ewss Faxa_taux - nsss Faxa_tauy - - - - - - CO2 Sa_co2diag - - - CO2 Sa_co2diag - - - CO2 Sa_co2diag - - - - - - BC_PREC Faxa_precsf - - - BC_PREC Faxa_precsf - - - - - - tas Sa_tbot_af - - - ps Sa_pbot_af - - - huss Sa_shum_af - - - uas Sa_u_af - - - vas Sa_v_af - - - pr Faxa_prec_af - - - rsds Faxa_swdn_af - - - rlds Faxa_lwdn_af - - - - - - a2x1d_Faxa_bcphiwet Faxa_bcphiwet - a2x1d_Faxa_bcphodry Faxa_bcphodry - a2x1d_Faxa_bcphidry Faxa_bcphidry - a2x1d_Faxa_ocphiwet Faxa_ocphiwet - a2x1d_Faxa_ocphidry Faxa_ocphidry - a2x1d_Faxa_ocphodry Faxa_ocphodry - a2x1d_Faxa_dstwet1 Faxa_dstwet1 - a2x1d_Faxa_dstdry1 Faxa_dstdry1 - a2x1d_Faxa_dstwet2 Faxa_dstwet2 - a2x1d_Faxa_dstdry2 Faxa_dstdry2 - a2x1d_Faxa_dstwet3 Faxa_dstwet3 - a2x1d_Faxa_dstdry3 Faxa_dstdry3 - a2x1d_Faxa_dstwet4 Faxa_dstwet4 - a2x1d_Faxa_dstdry4 Faxa_dstdry4 - - - BCDEPWET Faxa_bcphiwet - BCPHODRY Faxa_bcphodry - BCPHIDRY Faxa_bcphidry - OCDEPWET Faxa_ocphiwet - OCPHIDRY Faxa_ocphidry - OCPHODRY Faxa_ocphodry - DSTX01WD Faxa_dstwet1 - DSTX01DD Faxa_dstdry1 - DSTX02WD Faxa_dstwet2 - DSTX02DD Faxa_dstdry2 - DSTX03WD Faxa_dstwet3 - DSTX03DD Faxa_dstdry3 - DSTX04WD Faxa_dstwet4 - DSTX04DD Faxa_dstdry4 - - - - - - a2x3h_Sa_topo Sa_topo - - - TOPO Sa_topo - - - - - - - integer - streams - streams_file - Simulation year to align stream to. - - -999 - $DATM_CLMNCEP_YR_ALIGN - $DATM_CPLHIST_YR_ALIGN - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_ALIGN - 1 - 1 - 1 - 1 - 1900 - 1850 - 2015 - 1979 - 1979 - 2006 - $DATM_CPLHIST_YR_ALIGN - 1 - 1 - 1 - 1849 - 2015 - 1 - $DATM_CPLHIST_YR_ALIGN - - - - - integer - streams - streams_file - First year of stream. - - -999 - 1993 - 1992 - 0001 - $DATM_CPLHIST_YR_START - 2000 - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_START - 1 - 2010 - 2010 - 2010 - 2010 - 2010 - 2010 - 2010 - 2010 - 2010 - 2010 - 1948 - 1948 - 1948 - 1948 - 1948 - 1948 - 1948 - 1948 - 1948 - 1948 - 1948 - 1958 - 1958 - 1958 - 1958 - 1958 - 1958 - 1958 - 1958 - 1958 - 2019 - 1850 - 2015 - 2006 - $DATM_CPLHIST_YR_START - 1850 - 2000 - 2010 - 1849 - 2015 - 1 - $DATM_CPLHIST_YR_START - - - - - integer - streams - streams_file - Last year of stream. - - -999 - 1993 - 1992 - 0002 - $DATM_CPLHIST_YR_END - 2004 - $DATM_CLMNCEP_YR_END - $DATM_CLMNCEP_YR_END - $DATM_CLMNCEP_YR_END - $DATM_CLMNCEP_YR_END - 1 - 2011 - 2011 - 2011 - 2011 - 2011 - 2011 - 2011 - 2011 - 2011 - 2011 - 2009 - 2009 - 2009 - 2009 - 2009 - 2009 - 2009 - 2009 - 2009 - 2009 - 2009 - 2016 - 2016 - 2016 - 2016 - 2016 - 2016 - 2016 - 2016 - 2016 - 2019 - 2014 - 2500 - 2012 - 2010 - 2300 - $DATM_CPLHIST_YR_END - 1850 - 2000 - 2010 - 2014 - 2101 - 1 - $DATM_CPLHIST_YR_END - - - - - integer - streams - streams_file - Stream offset. - - 0 - -5400 - 2700 - 900 - 900 - 900 - 0 - 0 - - char(30) - streams - streams_file - redist,bilinear,nn - - array (up to 30 elements) of mapping algorithms associated with the array of streams. - valid values: redist,bilinear - - - bilinear - none - redist - redist - redist - none - nn - - - - - char(30) - streams - streams_file - coszen,nearest,linear,lower,upper - - array (up to 30 elements) of time interpolation options associated with the array of - streams. - valid values: lower,upper,nearest,linear,coszen - lower = Use lower time-value - upper = Use upper time-value - nearest = Use the nearest time-value - linear = Linearly interpolate between the two time-values - coszen = Scale according to the cosine of the solar zenith angle (for solar) - - - linear - nearest - nearest - nearest - linear - linear - nearest - nearest - coszen - nearest - coszen - nearest - coszen - nearest - coszen - nearest - nearest - nearest - nearest - nearest - nearest - nearest - nearest - nearest - nearest - nearest - - lower - coszen - - - - - char(30) - streams - streams_file - extend,cycle,limit - - array of time axis modes associated with the array of streams for - handling data outside the specified stream time axis. - valid options are to cycle the data based on the first, last, and - align settings associated with the stream dataset, to extend the first - and last valid value indefinitely, or to limit the interpolated data - to fall only between the least and greatest valid value of the time array. - valid values: cycle,extend,limit - - - cycle - extend - extend - extend - - - - - char(30) - streams - streams_file - single,full_file - - array (up to 30 elements) of reading mode associated with the array of - streams. specifies the mode of reading temporal stream dataset. - valid options are "single" (read temporal dataset one at a time) or - "full_file" (read all entires of temporal dataset in a given netcdf file) - valid values: single,full_file - - - single - - - - - real(30) - streams - streams_file - - array (up to 30 elements) of delta time ratio limits placed on the - time interpolation associated with the array of streams. this real - value causes the model to stop if the ratio of the running maximum - delta time divided by the minimum delta time is greater than the - dtlimit for that stream. for instance, with daily data, the delta - time should be exactly one day throughout the dataset and the computed - maximum divided by minimum delta time should always be 1.0. for - monthly data, the delta time should be between 28 and 31 days and the - maximum ratio should be about 1.1. the running value of the delta - time is computed as data is read and any wraparound or cycling is also - included. this input helps trap missing data or errors in cycling. - to turn off trapping, set the value to 1.0e30 or something similar. - - - 1.5 - 1.e30 - 1.e30 - 3.0 - 3.0 - 3.0 - 3.0 - 3.0 - 3.0 - - - - - char - streams - streams_file - - list of paired colon delimited field names that should be treated as - vectors when carrying out spatial interpolation. unlike other - character arrays in this namelist, this array is completely decoupled - from the list of streams. this is a list of vector pairs that span - all input streams where different fields of the vector pair could - appear in different streams. - for example, vectors = 'u:v','taux:tauy'. - - - null - u:v - u:v - u:v - u:v,taux:tauy - - - - - char(30) - streams - streams_file - - character array (up to 30 elements) of stream input files. this - string is actually parsed by a stream method and so the format is - specified by the stream module. this string consists of a - "stream_input_filename year_align year_first year_last". the - stream_input_filename is a stream text input file and the format and - options are described elsewhere. year_align, year_first, and - year_last provide information about the time axis of the file and how - to relate the input time axis to the model time axis. - - - - - - - - - - char datm @@ -2558,16 +66,16 @@ CLMNCEP,CORE2_NYF,CORE2_IAF,CORE_IAF_JRA,ERA5,CPLHIST general method that operates on the data. - datamode = "CPLHIST" + ----datamode = "CPLHIST"---- CPLHIST mode will examine the fields found in all input data streams, if any input field names match the field names used internally, they are copied into the export array and passed directly to the coupler without any special user code. Any required fields not found on an input stream will be set to zero except for aerosol deposition fields - which will be set to a special value. - datamode = "CORE2_NYF" + which will be set to a special value. + ----datamode = "CORE2_NYF"---- Coordinated Ocean-ice Reference Experiments (CORE) Version 2 Normal Year Forcing. - datamode = "CORE2_IAF" + ----datamode = "CORE2_IAF"---- In conjunction with with CORE Version 2 atmospheric forcing data, provides the atmosphere forcing favored by the Ocean Model Working Group when coupling an active ocean model with observed atmospheric @@ -2578,16 +86,16 @@ W.G.Large, S.G.Yeager (2008), The global climatology of an interannually varying air-sea flux data set. Clm Dyn doi 10.1007/s00382-008-0441-3. - datamode = "CORE_IAF_JRA" + ----datamode = "CORE_IAF_JRA"---- JRA55 intra-annual year forcing - datamode = "CLMNCEP" + ----datamode = "CLMNCEP"---- In conjunction with NCEP climatological atmosphere data, provides the atmosphere forcing favored by the Land Model Working Group when coupling an active land model with observed atmospheric forcing. This mode replicates code previously found in CLM (circa 2005), before the LMWG started using the CCSM flux coupler and data models to do active-land-only simulations. - datamode = "ERA5" + ----datamode = "ERA5"---- Fifth generation ECMWF atmospheric reanalysis of the global climate @@ -2615,7 +123,7 @@ - + char streams abs @@ -2683,8 +191,7 @@ $ATM_NY - - + char datm datm_nml @@ -2722,7 +229,7 @@ null $DIN_LOC_ROOT/atm/datm7/CORE2/COREv2.correction_factors.T62.121007.nc $DIN_LOC_ROOT/atm/datm7/CORE2/COREv2.correction_factors.T62.121007.nc - null + null @@ -2738,7 +245,7 @@ null $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc - null + null diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml new file mode 100644 index 000000000..732ab38d3 --- /dev/null +++ b/datm/cime_config/stream_definition_datm.xml @@ -0,0 +1,3837 @@ + + + + + + + + + + + + + + + + + $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/clmforc.GSWP3.c2011.0.5x0.5.TPQWL.SCRIP.210520_ESMFmesh.nc + + + $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/Solar/clmforc.GSWP3.c2011.0.5x0.5.Solr.%ym.nc + + + FSDS Faxa_swdn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + coszen + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/clmforc.GSWP3.c2011.0.5x0.5.TPQWL.SCRIP.210520_ESMFmesh.nc + + + $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/Precip/clmforc.GSWP3.c2011.0.5x0.5.Prec.%ym.nc + + + PRECTmms Faxa_precn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/clmforc.GSWP3.c2011.0.5x0.5.TPQWL.SCRIP.210520_ESMFmesh.nc + + + $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/TPHWL/clmforc.GSWP3.c2011.0.5x0.5.TPQWL.%ym.nc + + + TBOT Sa_tbot + WIND Sa_wind + QBOT Sa_shum + PSRF Sa_pbot + FLDS Faxa_lwdn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.c2016.0.5d.ESMFmesh_260520.nc + + + $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Solar6Hrly/clmforc.cruncep.V7.c2016.0.5d.Solr.%ym.nc + + + FSDS Faxa_swdn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + coszen + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.c2016.0.5d.ESMFmesh_260520.nc + + + $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Precip6Hrly/clmforc.cruncep.V7.c2016.0.5d.Prec.%ym.nc + + + PRECTmms Faxa_precn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.c2016.0.5d.ESMFmesh_260520.nc + + + $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/TPHWL6Hrly/clmforc.cruncep.V7.c2016.0.5d.TPQWL.%ym.nc + + + TBOT Sa_tbot + WIND Sa_wind + QBOT Sa_shum + PSRF Sa_pbot + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/Solar6Hrly/clmforc.Qian.c2006.T62.Solr.%ym.nc + + + FSDS Faxa_swdn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + coszen + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/Precip6Hrly/clmforc.Qian.c2006.T62.Prec.%ym.nc + + + PRECTmms Faxa_precn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/TmpPrsHumWnd3Hrly/clmforc.Qian.c2006.T62.TPQW.%ym.nc + + + TBOT Sa_tbot + WIND Sa_wind + QBOT Sa_shum + PSRF Sa_pbot + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/Solar6Hrly/clmforc.Qian.c2006.T62.Solr.%ym.nc + + + FSDS Faxaswdn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + 2000 + 2004 + 0 + + coszen + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/Precip6Hrly/clmforc.Qian.c2006.T62.Prec.%ym.nc + + + PRECTmms Faxa_precn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + 2000 + 2004 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/TmpPrsHumWnd3Hrly/clmforc.Qian.c2006.T62.TPQW.%ym.nc + + + TBOT Sa_tbot + WIND Sa_wind + QBOT Sa_shum + PSRF Sa_pbot + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + 2000 + 2004 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.0.125d.v1.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Solar/ctsmforc.NLDAS2.0.125d.v1.Solr.%ym.nc + + + FSDS Faxa_swdn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + coszen + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.0.125d.v1.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Precip/ctsmforc.NLDAS2.0.125d.v1.Prec.%ym.nc + + + PRECTmms Faxa_precn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.0.125d.v1.ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/TPQWL/ctsmforc.NLDAS2.0.125d.v1.TPQWL.%ym.nc + + + TBOT Sa_tbot + WIND Sa_wind + QBOT Sa_shum + PSRF Sa_pbot + FLDS Faxa_lwdn + + null + + bilinear + nn + + null + $DATM_CLMNCEP_YR_ALIGN + $DATM_CLMNCEP_YR_START + $DATM_CLMNCEP_YR_END + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/mexicocityMEX.c080124/clm1pt-1993-12.nc + + + ZBOT Sa_z + TBOT Sa_tbot + RH Sa_rh + WIND Sa_wind + PSRF Sa_pbot + PRECTmms Faxa_precn + FSDS Faxa_swdn + FSDSdir Faxa_swdndr + FSDSdif Faxa_swdndf + FLDS Faxa_lwdn + + null + + none + + null + $DATM_CLMNCEP_YR_ALIGN + 1993 + 1993 + 0 + + nearest + + + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/vancouverCAN.c080124/clm1pt-1992-08.nc + + + ZBOT Sa_z + TBOT Sa_tbot + RH Sa_rh + WIND Sa_wind + PSRF Sa_pbot + PRECTmms Faxa_precn + FSDS Faxa_swdn + FSDSdir Faxa_swdndr + FSDSdif Faxa_swdndf + FLDS Faxa_lwdn + + null + + none + + null + $DATM_CLMNCEP_YR_ALIGN + 1992 + 1992 + 0 + + nearest + + + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0001-08.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0001-09.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0001-10.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0001-11.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0001-12.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-01.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-02.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-03.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-04.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-05.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-06.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-07.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-08.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-09.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-10.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/urbanc_alpha.c080416/clm1pt-0002-11.nc + + + ZBOT Sa_z + TBOT Sa_tbot + RH Sa_rh + WIND Sa_wind + PSRF Sa_pbot + PRECTmms Faxa_precn + FSDS Faxa_swdn + FSDSdir Faxa_swdndr + FSDSdif Faxa_swdndf + FLDS Faxa_lwdn + + null + + none + + null + $DATM_CLMNCEP_YR_ALIGN + 0001 + 0002 + 0 + + nearest + + + extend + + + 1.e30 + + single + + + + + + + + + + + + $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/gpcp/qian/bias_correction.Prec.%y.nc + + + BC_PREC Faxa_precsf + + null + + bilinear + nn + + null + 1979 + 1979 + 2004 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + + + + $DIN_LOC_ROOT/atm/datm7/clm_output/cruncep_precip_1deg/gpcp_1deg_bias_correction/bias_correction.Prec.%y.nc + + + BC_PREC Faxa_precsf + + null + + bilinear + nn + + null + 1979 + 1979 + 2012 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + + + + $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/cmap/cruncep/bias_correction.Prec.%y.nc + + + BC_PREC Faxa_precsf + + null + + bilinear + nn + + null + 1979 + 1979 + 2010 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + + + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.pr.ccsm4.rcp45.2006-2300.nc + + + pr Faxa_prec_af + + null + + bilinear + nn + + null + 2006 + 2006 + 2300 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.tas.ccsm4.rcp45.2006-2300.nc + + + tas Sa_tbot_af + + null + + bilinear + nn + + null + 2006 + 2006 + 2300 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.ps.ccsm4.rcp45.2006-2300.nc + + + ps Sa_pbot_af + + null + + bilinear + nn + + null + 2006 + 2006 + 2300 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.huss.ccsm4.rcp45.2006-2300.nc + + + huss Sa_shum_af + + null + + bilinear + nn + + null + 2006 + 2300 + 2300 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.uas.ccsm4.rcp45.2006-2300.nc + + + uas Sa_u_af + + null + + bilinear + nn + + null + 2006 + 2006 + 2300 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.vas.ccsm4.rcp45.2006-2300.nc + + + vas Sa_v_af + + null + + bilinear + nn + + null + 2006 + 2006 + 2300 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.rsds.ccsm4.rcp45.2006-2300.nc + + + rsds Faxa_swdn_af + + null + + bilinear + nn + + null + 2006 + 2006 + 2300 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.rlds.ccsm4.rcp45.2006-2300.nc + + + rlds Faxa_lwdn_af + + null + + bilinear + nn + + null + 2006 + 2006 + 2300 + 0 + + nearest + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/atm/datm7/NYF/nyf.giss.T62.051007.nc + + + lwdn Faxa_lwdn + swdn Faxa_swdn + swup Faxa_swup + + null + + bilinear + nn + + u:v + 1 + 1 + 1 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/atm/datm7/NYF/nyf.gxgxs.T62.051007.nc + + + prc Faxa_prec + + null + + bilinear + nn + + u:v + 1 + 1 + 1 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/atm/datm7/NYF/nyf.ncep.T62.050923.nc + + + dn10 Sa_dens + slp_ Sa_pslv + q_10 Sa_shum + t_10 Sa_tbot + u_10 Sa_u + v_10 Sa_v + + null + + bilinear + nn + + u:v + 1 + 1 + 1 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/ncep.SOFS.2010.nc + + + dn10 Sa_dens + + null + + bilinear + nn + + u:v + 1 + 2010 + 2011 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/ncep.SOFS.2010.nc + + + slp_ Sa_pslv + + null + + bilinear + nn + + u:v + 1 + 2010 + 2011 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc + + + prec Faxa_prec + + null + + bilinear + nn + + u:v + 1 + 2010 + 2011 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc + + + lwdn Faxa_lwdn + + null + + bilinear + nn + + u:v + 1 + 2010 + 2011 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc + + + swdn Faxa_swdn + + null + + bilinear + nn + + u:v + 1 + 2010 + 2011 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/SOFS.daily.03-09.2010.nc + + + swup Faxa_swup + + null + + bilinear + nn + + u:v + 1 + 2010 + 2011 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc + + + q3_5 Faxa_shum + + null + + bilinear + nn + + u:v + 1 + 2010 + 2011 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc + + + t3_5 Sa_tbot + + null + + bilinear + nn + + u:v + 1 + 2010 + 2011 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc + + + u3_5 Sa_u + + null + + bilinear + nn + + u:v + 1 + 2010 + 2011 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/SOFS.6hour.03-09.2010.nc + + + v3_5 Sa_v + + null + + bilinear + nn + + u:v + 1 + 2010 + 2011 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/gcgcs.prec.T62.%y.20120412.nc + + + prc Faxa_prec + + null + + bilinear + nn + + u:v + 1 + 1948 + 2009 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/giss.lwdn.T62.%y.20120412.nc + + + lwdn Faxa_lwdn + + null + + bilinear + nn + + u:v + 1 + 1948 + 2009 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/giss.swdn.T62.%y.20120412.nc + + + swdn Faxa_swdn + + null + + bilinear + nn + + u:v + 1 + 1948 + 2009 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/giss.swup.T62.%y.20120412.nc + + + swup Faxa_swup + + null + + bilinear + nn + + u:v + 1 + 1948 + 2009 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.%y.20120414.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.dn10.T62.%y.20120412.nc + + + dn10 Sa_dens + + null + + bilinear + nn + + u:v + 1 + 1948 + 2009 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.2005.20120414.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.q_10.T62.%y.20120412.nc + + + q_10 Sa_shum + + null + + bilinear + nn + + u:v + 1 + 1948 + 2009 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.2005.20120414.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.slp_.T62.%y.20120412.nc + + + slp_ Sa_pslv + + null + + bilinear + nn + + u:v + 1 + 1948 + 2009 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.2005.20120414.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.t_10.T62.%y.20120412.nc + + + t_10 Sa_tbot + + null + + bilinear + nn + + u:v + 1 + 1948 + 2009 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.2005.20120414.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.u_10.T62.%y.20120412.nc + + + u_10 Sa_u + + null + + bilinear + nn + + u:v + 1 + 1948 + 2009 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.2005.20120414.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ncep.v_10.T62.%y.20120412.nc + + + v_10 Sa_v + + null + + bilinear + nn + + u:v + 1 + 1948 + 2009 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/atm/datm7/CORE2/CORE2.t_10.ArcFactor.T62.1997-2004.nc + + + TarcFactor tarcf + + null + + bilinear + nn + + u:v + 1 + 1948 + 2009 + 0 + + linear + + + cycle + extend + + + 1.e30 + + single + + + + + + + + + + + + + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.%y.171019.nc + + + prec Faxa_prec + + null + + bilinear + nn + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.%y.171019.nc + + + lwdn Faxa_lwdn + + null + + bilinear + nn + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.%y.171019.nc + + + swdn Faxa_swdn + + null + + bilinear + nn + + u:v + 1 + 1958 + 2016 + -5400 + + coszen + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.%y.171019.nc + + + q_10 Sa_shum + + null + + bilinear + nn + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.%y.171019.nc + + + slp Sa_pslv + + null + + bilinear + nn + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.%y.171019.nc + + + t_10 Sa_tbot + + null + + bilinear + nn + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.%y.171019.nc + + + u_10 Sa_u + + null + + bilinear + nn + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.%y.171019.nc + + + v_10 Sa_v + + null + + bilinear + nn + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + + + $DIN_LOC_ROOT/atm/datm7/CORE2/CORE2.t_10.ArcFactor.T62.1997-2004.nc + + + TarcFactor tarcf + + null + + bilinear + nn + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + extend + + + 1.e30 + + single + + + + + + + + + $DIN_LOC_ROOT/share/meshes/TL639_200618_ESMFmesh.nc + + + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.01.200618.nc + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.02.200618.nc + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.03.200618.nc + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.04.200618.nc + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.05.200618.nc + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.06.200618.nc + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.07.200618.nc + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.08.200618.nc + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.09.200618.nc + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.10.200618.nc + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.11.200618.nc + $DIN_LOC_ROOT/atm/datm7/ERA5/ERA5.TL639.2019.12.200618.nc + + + u10 Sa_u + v10 Sa_v + t2m Sa_tbot + skt Sa_tskn + d2m Sa_tdew + msl Sa_pslv + sp Sa_pbot + tp Faxa_rain + cp Faxa_rainc + lsp Faxa_rainl + csf Faxa_snowc + lsf Faxa_snowl + ssrd Faxa_swdn + ssr Faxa_swnet + strd Faxa_lwdn + str Faxa_lwnet + aluvp Faxa_swvdr + aluvd Faxa_swvdf + alnip Faxa_swndr + alnid Faxa_swndf + sshf Faxa_sen + slhf Faxa_lat + ewss Faxa_taux + nsss Faxa_tauy + + null + + bilinear + nn + + + u:v + 1900 + 2019 + 2019 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + + + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_global_simyr_1750-2014_CMIP6_c180929.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 1850 + 1850 + 2014 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_global_ssp585_simyr_1750-2020_CMIP6_c200324.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 213 + 1850 + 2010 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_global_ssp585_simyr_1750-2020_CMIP6_c200324.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 198 + 1850 + 2019 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP1-1.9_simyr_2014-2500_CMIP6_c190514.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP1-2.6__simyr_2014-2500_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP2-4.5__simyr_2014-2500_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/co2_datm_lat-bandsSSP3-7.0__simyr_2014-2500_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP4-3.4_simyr_2014-2500_CMIP6_c190514.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP4-6.0__simyr_2014-2500_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP5-3.4__simyr_2014-2500_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_lat-bandsSSP5-8.5__simyr_2014-2500_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP1-1.9_simyr_2014-2501_CMIP6_c190514.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP1-2.6__simyr_2014-2501_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP2-4.5__simyr_2014-2501_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP3-7.0__simyr_2014-2501_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP4-3.4_simyr_2014-2501_CMIP6_c190514.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP4-6.0__simyr_2014-2501_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP5-3.4__simyr_2014-2501_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + none + + + $DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP5-8.5__simyr_2014-2501_CMIP6_c190506.nc + + + CO2 Sa_co2diag + + null + + none + nn + + null + 2015 + 2015 + 2500 + 0 + + linear + + + extend + extend + + + 1.e30 + + single + + + + + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc + + + BCDEPWET Faxa_bcphiwet + BCPHODRY Faxa_bcphodry + BCPHIDRY Faxa_bcphidry + OCDEPWET Faxa_ocphiwet + OCPHIDRY Faxa_ocphidry + OCPHODRY Faxa_ocphodry + DSTX01WD Faxa_dstwet1 + DSTX01DD Faxa_dstdry1 + DSTX02WD Faxa_dstwet2 + DSTX02DD Faxa_dstdry2 + DSTX03WD Faxa_dstwet3 + DSTX03DD Faxa_dstdry3 + DSTX04WD Faxa_dstwet4 + DSTX04DD Faxa_dstdry4 + + null + + bilinear + nn + nn + + null + 1 + 1850 + 1850 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc + + + BCDEPWET Faxa_bcphiwet + BCPHODRY Faxa_bcphodry + BCPHIDRY Faxa_bcphidry + OCDEPWET Faxa_ocphiwet + OCPHIDRY Faxa_ocphidry + OCPHODRY Faxa_ocphodry + DSTX01WD Faxa_dstwet1 + DSTX01DD Faxa_dstdry1 + DSTX02WD Faxa_dstwet2 + DSTX02DD Faxa_dstdry2 + DSTX03WD Faxa_dstwet3 + DSTX03DD Faxa_dstdry3 + DSTX04WD Faxa_dstwet4 + DSTX04DD Faxa_dstdry4 + + null + + bilinear + nn + nn + + null + 1 + 2000 + 2000 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc + + + BCDEPWET Faxa_bcphiwet + BCPHODRY Faxa_bcphodry + BCPHIDRY Faxa_bcphidry + OCDEPWET Faxa_ocphiwet + OCPHIDRY Faxa_ocphidry + OCPHODRY Faxa_ocphodry + DSTX01WD Faxa_dstwet1 + DSTX01DD Faxa_dstdry1 + DSTX02WD Faxa_dstwet2 + DSTX02DD Faxa_dstdry2 + DSTX03WD Faxa_dstwet3 + DSTX03DD Faxa_dstdry3 + DSTX04WD Faxa_dstwet4 + DSTX04DD Faxa_dstdry4 + + null + + bilinear + nn + nn + + null + 1 + 2010 + 2010 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc + + + BCDEPWET Faxa_bcphiwet + BCPHODRY Faxa_bcphodry + BCPHIDRY Faxa_bcphidry + OCDEPWET Faxa_ocphiwet + OCPHIDRY Faxa_ocphidry + OCPHODRY Faxa_ocphodry + DSTX01WD Faxa_dstwet1 + DSTX01DD Faxa_dstdry1 + DSTX02WD Faxa_dstwet2 + DSTX02DD Faxa_dstdry2 + DSTX03WD Faxa_dstwet3 + DSTX03DD Faxa_dstdry3 + DSTX04WD Faxa_dstwet4 + DSTX04DD Faxa_dstdry4 + + null + + bilinear + nn + + null + 1849 + 1849 + 2014 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP126_b.e21.BSSP126cmip6.f09_g17.CMIP6-SSP1-2.6.001_2014-2101_monthly_0.9x1.25_c190523.nc + + + BCDEPWET Faxa_bcphiwet + BCPHODRY Faxa_bcphodry + BCPHIDRY Faxa_bcphidry + OCDEPWET Faxa_ocphiwet + OCPHIDRY Faxa_ocphidry + OCPHODRY Faxa_ocphodry + DSTX01WD Faxa_dstwet1 + DSTX01DD Faxa_dstdry1 + DSTX02WD Faxa_dstwet2 + DSTX02DD Faxa_dstdry2 + DSTX03WD Faxa_dstwet3 + DSTX03DD Faxa_dstdry3 + DSTX04WD Faxa_dstwet4 + DSTX04DD Faxa_dstdry4 + + null + + bilinear + nn + + null + 2015 + 2015 + 2101 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP245_b.e21.BWSSP245cmip6.f09_g17.CMIP6-SSP2-4.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.nc + + + BCDEPWET Faxa_bcphiwet + BCPHODRY Faxa_bcphodry + BCPHIDRY Faxa_bcphidry + OCDEPWET Faxa_ocphiwet + OCPHIDRY Faxa_ocphidry + OCPHODRY Faxa_ocphodry + DSTX01WD Faxa_dstwet1 + DSTX01DD Faxa_dstdry1 + DSTX02WD Faxa_dstwet2 + DSTX02DD Faxa_dstdry2 + DSTX03WD Faxa_dstwet3 + DSTX03DD Faxa_dstdry3 + DSTX04WD Faxa_dstwet4 + DSTX04DD Faxa_dstdry4 + + null + + bilinear + nn + + null + 2015 + 2015 + 2101 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_2014-2101_monthly_0.9x1.25_c190402.nc + + + BCDEPWET Faxa_bcphiwet + BCPHODRY Faxa_bcphodry + BCPHIDRY Faxa_bcphidry + OCDEPWET Faxa_ocphiwet + OCPHIDRY Faxa_ocphidry + OCPHODRY Faxa_ocphodry + DSTX01WD Faxa_dstwet1 + DSTX01DD Faxa_dstdry1 + DSTX02WD Faxa_dstwet2 + DSTX02DD Faxa_dstdry2 + DSTX03WD Faxa_dstwet3 + DSTX03DD Faxa_dstdry3 + DSTX04WD Faxa_dstwet4 + DSTX04DD Faxa_dstdry4 + + null + + bilinear + nn + + null + 2015 + 2015 + 2101 + 0 + + linear + + + cycle + extend + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + null + + + BCDEPWET Faxa_bcphiwet + BCPHODRY Faxa_bcphodry + BCPHIDRY Faxa_bcphidry + OCDEPWET Faxa_ocphiwet + OCPHIDRY Faxa_ocphidry + OCPHODRY Faxa_ocphodry + DSTX01WD Faxa_dstwet1 + DSTX01DD Faxa_dstdry1 + DSTX02WD Faxa_dstwet2 + DSTX02DD Faxa_dstdry2 + DSTX03WD Faxa_dstwet3 + DSTX03DD Faxa_dstdry3 + DSTX04WD Faxa_dstwet4 + DSTX04DD Faxa_dstdry4 + + null + + bilinear + nn + + null + 2015 + 2015 + 2101 + 0 + + linear + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP585_b.e21.BSSP585cmip6.f09_g17.CMIP6-SSP5-8.5.001_2014-2101_monthly_0.9x1.25_c190419.nc + + + BCDEPWET Faxa_bcphiwet + BCPHODRY Faxa_bcphodry + BCPHIDRY Faxa_bcphidry + OCDEPWET Faxa_ocphiwet + OCPHIDRY Faxa_ocphidry + OCPHODRY Faxa_ocphodry + DSTX01WD Faxa_dstwet1 + DSTX01DD Faxa_dstdry1 + DSTX02WD Faxa_dstwet2 + DSTX02DD Faxa_dstdry2 + DSTX03WD Faxa_dstwet3 + DSTX03DD Faxa_dstdry3 + DSTX04WD Faxa_dstwet4 + DSTX04DD Faxa_dstdry4 + + null + + bilinear + nn + + null + 2015 + 2015 + 2101 + 0 + + linear + + + cycle + extend + + + 1.5 + + single + + + + + + + + + $ATM_DOMAIN_MESH + + + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc + + + a2x3h_Sa_topo Sa_topo + + null + + bilinear + nn + + null + $DATM_CPLHIST_YR_ALIGN + $DATM_CPLHIST_YR_START + $DATM_CPLHIST_YR_END + 0 + + nearest + + + cycle + extend + + + 3.0 + + single + + + + $ATM_DOMAIN_MESH + + + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1d.%ym.nc + + + a2x1d_Faxa_bcphiwet Faxa_bcphiwet + a2x1d_Faxa_bcphodry Faxa_bcphodry + a2x1d_Faxa_bcphidry Faxa_bcphidry + a2x1d_Faxa_ocphiwet Faxa_ocphiwet + a2x1d_Faxa_ocphidry Faxa_ocphidry + a2x1d_Faxa_ocphodry Faxa_ocphodry + a2x1d_Faxa_dstwet1 Faxa_dstwet1 + a2x1d_Faxa_dstdry1 Faxa_dstdry1 + a2x1d_Faxa_dstwet2 Faxa_dstwet2 + a2x1d_Faxa_dstdry2 Faxa_dstdry2 + a2x1d_Faxa_dstwet3 Faxa_dstwet3 + a2x1d_Faxa_dstdry3 Faxa_dstdry3 + a2x1d_Faxa_dstwet4 Faxa_dstwet4 + a2x1d_Faxa_dstdry4 Faxa_dstdry4 + + null + + bilinear + nn + + null + $DATM_CPLHIST_YR_ALIGN + $DATM_CPLHIST_YR_START + $DATM_CPLHIST_YR_END + 0 + + nearest + + + cycle + extend + + + 3.0 + + single + + + + + $ATM_DOMAIN_MESH + + + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1hi.%ym.nc + + + a2x1hi_Faxa_swndr Faxa_swndr + a2x1hi_Faxa_swvdr Faxa_swvdr + a2x1hi_Faxa_swndf Faxa_swndf + a2x1hi_Faxa_swvdf Faxa_swvdf + + null + + bilinear + nn + + null + $DATM_CPLHIST_YR_ALIGN + $DATM_CPLHIST_YR_START + $DATM_CPLHIST_YR_END + 2700 + + nearest + + + cycle + extend + + + 3.0 + + single + + + + + $ATM_DOMAIN_MESH + + + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc + + + a2x3h_Faxa_rainc Faxa_rainc + a2x3h_Faxa_rainl Faxa_rainl + a2x3h_Faxa_snowc Faxa_snowc + a2x3h_Faxa_snowl Faxa_snowl + a2x3h_Faxa_lwdn Faxa_lwdn + + null + + bilinear + nn + + null + $DATM_CPLHIST_YR_ALIGN + $DATM_CPLHIST_YR_START + $DATM_CPLHIST_YR_END + 900 + + nearest + + + cycle + extend + + + 3.0 + + single + + + + + $ATM_DOMAIN_MESH + + + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc + + + a2x3h_Sa_z Sa_z + a2x3h_Sa_tbot Sa_tbot + a2x3h_Sa_ptem Sa_ptem + a2x3h_Sa_shum Sa_shum + a2x3h_Sa_pbot Sa_pbot + a2x3h_Sa_dens Sa_dens + a2x3h_Sa_pslv Sa_pslv + a2x3h_Sa_co2diag Sa_co2diag + a2x3h_Sa_co2prog Sa_co2prog + + null + + bilinear + nn + + null + $DATM_CPLHIST_YR_ALIGN + $DATM_CPLHIST_YR_START + $DATM_CPLHIST_YR_END + 900 + + linear + + + cycle + extend + + + 3.0 + + single + + + + + $ATM_DOMAIN_MESH + + + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1h.%ym.nc + + + a2x1h_Sa_u Sa_u + a2x1h_Sa_v Sa_v + + null + + bilinear + nn + + null + $DATM_CPLHIST_YR_ALIGN + $DATM_CPLHIST_YR_START + $DATM_CPLHIST_YR_END + 900 + + linear + + + cycle + extend + + + 3.0 + + single + + + + + + + + + $DIN_LOC_ROOT/atm/datm7/topo_forcing/topodata_0.9x1.SCRIP.210520_ESMFmesh.nc + + + $DIN_LOC_ROOT/atm/datm7/topo_forcing/topodata_0.9x1.25_USGS_070110_stream_c151201.nc + + + TOPO Sa_topo + + null + + bilinear + nn + + null + 1 + 1 + 1 + 0 + + + + + + lower + + + cycle + extend + + + 1.5 + 1.e30 + + single + + + diff --git a/datm/cime_config/testdefs/testlist_datm.xml b/datm/cime_config/testdefs/testlist_datm.xml index 2560fb1b8..cad80b14f 100644 --- a/datm/cime_config/testdefs/testlist_datm.xml +++ b/datm/cime_config/testdefs/testlist_datm.xml @@ -1,7 +1,7 @@ - + @@ -102,5 +102,13 @@ + + + + + + + + diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index 84a206c1a..f4664b341 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -35,8 +35,6 @@ module datm_datamode_clmncep_mod real(r8), pointer :: Sa_dens(:) => null() real(r8), pointer :: Sa_pbot(:) => null() real(r8), pointer :: Sa_pslv(:) => null() - real(r8), pointer :: Sa_co2prog(:) => null() ! co2 - real(r8), pointer :: Sa_co2diag(:) => null() ! co2 real(r8), pointer :: Faxa_lwdn(:) => null() real(r8), pointer :: Faxa_rainc(:) => null() real(r8), pointer :: Faxa_rainl(:) => null() @@ -47,7 +45,6 @@ module datm_datamode_clmncep_mod real(r8), pointer :: Faxa_swvdr(:) => null() real(r8), pointer :: Faxa_swvdf(:) => null() real(r8), pointer :: Faxa_swnet(:) => null() - real(r8), pointer :: Faxa_swdn(:) => null() ! stream data real(r8), pointer :: strm_z(:) => null() @@ -61,7 +58,6 @@ module datm_datamode_clmncep_mod real(r8), pointer :: strm_swdn(:) => null() real(r8), pointer :: strm_swdndf(:) => null() real(r8), pointer :: strm_swdndr(:) => null() - real(r8), pointer :: strm_prec(:) => null() real(r8), pointer :: strm_precc(:) => null() real(r8), pointer :: strm_precl(:) => null() real(r8), pointer :: strm_precn(:) => null() @@ -319,11 +315,9 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r end subroutine datm_datamode_clmncep_init_pointers !=============================================================================== - subroutine datm_datamode_clmncep_advance(importState, exportState, masterproc, logunit, mpicom, rc) + subroutine datm_datamode_clmncep_advance(masterproc, logunit, mpicom, rc) ! input/output variables - type(ESMF_State) , intent(inout) :: importState - type(ESMF_State) , intent(inout) :: exportState logical , intent(in) :: masterproc integer , intent(in) :: logunit integer , intent(in) :: mpicom @@ -331,7 +325,7 @@ subroutine datm_datamode_clmncep_advance(importState, exportState, masterproc, l ! local variables logical :: first_time = .true. - integer :: n,kf ! indices + integer :: n ! indices integer :: lsize ! size of attr vect real(r8) :: rtmp real(r8) :: swndr @@ -546,7 +540,7 @@ end subroutine datm_datamode_clmncep_advance !=============================================================================== subroutine datm_datamode_clmncep_restart_write(case_name, inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) ! input/output variables character(len=*) , intent(in) :: case_name @@ -555,12 +549,11 @@ subroutine datm_datamode_clmncep_restart_write(case_name, inst_suffix, ymd, tod, integer , intent(in) :: tod ! model sec into model date integer , intent(in) :: logunit integer , intent(in) :: my_task - integer , intent(in) :: mpicom type(shr_strdata_type) , intent(inout) :: sdat !------------------------------------------------------------------------------- call dshr_restart_write(rpfile, case_name, 'datm', inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) end subroutine datm_datamode_clmncep_restart_write diff --git a/datm/datm_datamode_core2_mod.F90 b/datm/datm_datamode_core2_mod.F90 index cf2f97dec..aae90a23e 100644 --- a/datm/datm_datamode_core2_mod.F90 +++ b/datm/datm_datamode_core2_mod.F90 @@ -43,7 +43,6 @@ module datm_datamode_core2_mod real(r8), pointer :: Faxa_swvdr(:) => null() real(r8), pointer :: Faxa_swvdf(:) => null() real(r8), pointer :: Faxa_swnet(:) => null() - real(r8), pointer :: Faxa_swdn(:) => null() ! stream data real(r8), pointer :: strm_prec(:) => null() @@ -249,18 +248,16 @@ subroutine datm_datamode_core2_init_pointers(exportState, sdat, datamode, factor end subroutine datm_datamode_core2_init_pointers !=============================================================================== - subroutine datm_datamode_core2_advance(exportstate, datamode, target_ymd, target_tod, target_mon, & - model_calendar, factorfn_mesh, factorfn_data, rc) + subroutine datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_mon, & + model_calendar, factorfn_mesh, rc) ! input/output variables - type(ESMF_State) , intent(inout) :: exportState character(len=*) , intent(in) :: datamode integer , intent(in) :: target_ymd integer , intent(in) :: target_tod integer , intent(in) :: target_mon character(len=*) , intent(in) :: model_calendar character(len=*) , intent(in) :: factorfn_mesh - character(len=*) , intent(in) :: factorfn_data integer , intent(out) :: rc ! local variables @@ -371,7 +368,7 @@ end subroutine datm_datamode_core2_advance !=============================================================================== subroutine datm_datamode_core2_restart_write(case_name, inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) ! input/output variables character(len=*) , intent(in) :: case_name @@ -380,12 +377,11 @@ subroutine datm_datamode_core2_restart_write(case_name, inst_suffix, ymd, tod, & integer , intent(in) :: tod ! model sec into model date integer , intent(in) :: logunit integer , intent(in) :: my_task - integer , intent(in) :: mpicom type(shr_strdata_type) , intent(inout) :: sdat !------------------------------------------------------------------------------- call dshr_restart_write(rpfile, case_name, 'datm', inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) end subroutine datm_datamode_core2_restart_write @@ -426,9 +422,6 @@ subroutine datm_get_adjustment_factors(sdat, fileName_mesh, fileName_data, windF type(ESMF_Field) :: field_src type(ESMF_Field) :: field_dst integer :: lsize - integer :: gsize - integer :: n ! generic indicies - logical :: domap ! map or not integer, pointer :: gindex(:) ! domain decomposition of data integer :: ndims ! number of dims integer, allocatable :: dimid(:) diff --git a/datm/datm_datamode_era5_mod.F90 b/datm/datm_datamode_era5_mod.F90 index ac37e22d7..30f4a49ff 100644 --- a/datm/datm_datamode_era5_mod.F90 +++ b/datm/datm_datamode_era5_mod.F90 @@ -27,13 +27,14 @@ module datm_datamode_era5_mod real(r8), pointer :: Sa_z(:) => null() real(r8), pointer :: Sa_u(:) => null() real(r8), pointer :: Sa_v(:) => null() + real(r8), pointer :: Sa_wspd(:) => null() real(r8), pointer :: Sa_tbot(:) => null() real(r8), pointer :: Sa_ptem(:) => null() real(r8), pointer :: Sa_shum(:) => null() real(r8), pointer :: Sa_dens(:) => null() real(r8), pointer :: Sa_pbot(:) => null() - real(r8), pointer :: Sa_pslv(:) => null() real(r8), pointer :: Faxa_lwdn(:) => null() + real(r8), pointer :: Faxa_lwnet(:) => null() real(r8), pointer :: Faxa_rain(:) => null() real(r8), pointer :: Faxa_rainc(:) => null() real(r8), pointer :: Faxa_rainl(:) => null() @@ -53,7 +54,6 @@ module datm_datamode_era5_mod ! stream data real(r8), pointer :: strm_tdew(:) => null() - logical :: atm_prognostic = .false. real(r8) :: tbotmax ! units detector real(r8) :: tdewmax ! units detector @@ -61,7 +61,7 @@ module datm_datamode_era5_mod real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg real(r8) , parameter :: rhofw = SHR_CONST_RHOFW ! density of fresh water ~ kg/m^3 - character(*), parameter :: nullstr = 'null' + character(*), parameter :: nullstr = 'undefined' character(*), parameter :: rpfile = 'rpointer.atm' character(*), parameter :: u_FILE_u = & __FILE__ @@ -89,7 +89,9 @@ subroutine datm_datamode_era5_advertise(exportState, fldsexport, & call dshr_fldList_add(fldsExport, 'Sa_z' ) call dshr_fldList_add(fldsExport, 'Sa_u' ) call dshr_fldList_add(fldsExport, 'Sa_v' ) + call dshr_fldList_add(fldsExport, 'Sa_wspd' ) call dshr_fldList_add(fldsExport, 'Sa_tbot' ) + call dshr_fldList_add(fldsExport, 'Sa_tskn' ) call dshr_fldList_add(fldsExport, 'Sa_ptem' ) call dshr_fldList_add(fldsExport, 'Sa_dens' ) call dshr_fldList_add(fldsExport, 'Sa_pslv' ) @@ -104,9 +106,10 @@ subroutine datm_datamode_era5_advertise(exportState, fldsexport, & call dshr_fldList_add(fldsExport, 'Faxa_swvdr' ) call dshr_fldList_add(fldsExport, 'Faxa_swndf' ) call dshr_fldList_add(fldsExport, 'Faxa_swvdf' ) + call dshr_fldList_add(fldsExport, 'Faxa_swdn' ) call dshr_fldList_add(fldsExport, 'Faxa_swnet' ) call dshr_fldList_add(fldsExport, 'Faxa_lwdn' ) - call dshr_fldList_add(fldsExport, 'Faxa_swdn' ) + call dshr_fldList_add(fldsExport, 'Faxa_lwnet' ) call dshr_fldList_add(fldsExport, 'Faxa_sen' ) call dshr_fldList_add(fldsExport, 'Faxa_lat' ) call dshr_fldList_add(fldsExport, 'Faxa_taux' ) @@ -116,7 +119,7 @@ subroutine datm_datamode_era5_advertise(exportState, fldsexport, & do while (associated(fldlist)) call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite('(datm_comp_advertise): Fr_atm'//trim(fldList%stdname), ESMF_LOGMSG_INFO) + call ESMF_LogWrite('(datm_comp_advertise): Fr_atm '//trim(fldList%stdname), ESMF_LOGMSG_INFO) fldList => fldList%next enddo @@ -131,7 +134,6 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) integer , intent(out) :: rc ! local variables - type(ESMF_StateItem_Flag) :: itemFlag character(len=*), parameter :: subname='(datm_init_pointers): ' !------------------------------------------------------------------------------- @@ -144,6 +146,12 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) ! get export state pointers call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_v' , fldptr1=Sa_v , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_wspd' , fldptr1=Sa_wspd , allowNullReturn=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_tbot' , fldptr1=Sa_tbot , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_pbot' , fldptr1=Sa_pbot , rc=rc) @@ -176,6 +184,8 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_swdn' , fldptr1=Faxa_swdn , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_lwnet' , fldptr1=Faxa_lwnet , allowNullReturn=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_sen' , fldptr1=Faxa_sen , rc=rc) @@ -204,17 +214,12 @@ subroutine datm_datamode_era5_advance(exportstate, masterproc, logunit, mpicom, ! local variables logical :: first_time = .true. - integer :: n,kf ! indices + integer :: n ! indices integer :: lsize ! size of attr vect real(r8) :: rtmp - real(r8) :: swndr - real(r8) :: swndf - real(r8) :: swvdr - real(r8) :: swvdf - real(r8) :: ratio_rvrf real(r8) :: tbot, pbot real(r8) :: vp - real(r8) :: ea, e, qsat, frac + real(r8) :: e, qsat character(len=*), parameter :: subname='(datm_datamode_era5_advance): ' !------------------------------------------------------------------------------- @@ -241,6 +246,11 @@ subroutine datm_datamode_era5_advance(exportstate, masterproc, logunit, mpicom, !--- bottom layer height --- Sa_z(n) = 10.0_r8 + !--- calculate wind speed --- + if (associated(Sa_wspd)) then + Sa_wspd(n) = sqrt(Sa_u(n)*Sa_u(n)+Sa_v(n)*Sa_v(n)) + end if + !--- temperature --- if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz ! Limit very cold forcing to 180K @@ -265,8 +275,11 @@ subroutine datm_datamode_era5_advance(exportstate, masterproc, logunit, mpicom, Faxa_swvdf(n) = Faxa_swdn(n)*Faxa_swvdf(n) Faxa_swndf(n) = Faxa_swdn(n)*Faxa_swndf(n) + !--- TODO: need to understand relationship between shortwave bands and net shortwave rad. + !--- currently it is provided directly from ERA5 and the total of the bands are not + !--- consistent with the swnet !--- swnet: a diagnostic quantity --- - Faxa_swnet(n) = Faxa_swndr(n) + Faxa_swvdr(n) + Faxa_swndf(n) + Faxa_swvdf(n) + !Faxa_swnet(n) = Faxa_swndr(n) + Faxa_swvdr(n) + Faxa_swndf(n) + Faxa_swvdf(n) end do !---------------------------------------------------------- @@ -275,6 +288,9 @@ subroutine datm_datamode_era5_advance(exportstate, masterproc, logunit, mpicom, ! convert J/m^2 to W/m^2 Faxa_lwdn(:) = Faxa_lwdn(:)/3600.0_r8 + if (associated(Faxa_lwnet)) then + Faxa_lwnet(:) = Faxa_lwnet(:)/3600.0_r8 + end if Faxa_swdn(:) = Faxa_swdn(:)/3600.0_r8 Faxa_swvdr(:) = Faxa_swvdr(:)/3600.0_r8 Faxa_swndr(:) = Faxa_swndr(:)/3600.0_r8 @@ -299,7 +315,7 @@ end subroutine datm_datamode_era5_advance !=============================================================================== subroutine datm_datamode_era5_restart_write(case_name, inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) ! input/output variables character(len=*) , intent(in) :: case_name @@ -308,12 +324,11 @@ subroutine datm_datamode_era5_restart_write(case_name, inst_suffix, ymd, tod, & integer , intent(in) :: tod ! model sec into model date integer , intent(in) :: logunit integer , intent(in) :: my_task - integer , intent(in) :: mpicom type(shr_strdata_type) , intent(inout) :: sdat !------------------------------------------------------------------------------- call dshr_restart_write(rpfile, case_name, 'datm', inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) end subroutine datm_datamode_era5_restart_write diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index 4d313fee9..653e9251b 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -39,7 +39,6 @@ module datm_datamode_jra_mod real(r8), pointer :: Faxa_swvdr(:) => null() real(r8), pointer :: Faxa_swvdf(:) => null() real(r8), pointer :: Faxa_swnet(:) => null() - real(r8), pointer :: Faxa_swdn(:) => null() ! stream data real(r8), pointer :: strm_prec(:) => null() @@ -208,7 +207,6 @@ subroutine datm_datamode_jra_advance(exportstate, target_ymd, target_tod, model_ real(R8) :: avg_alb ! average albedo real(R8) :: rday ! elapsed day real(R8) :: cosFactor ! cosine factor - real(R8) :: factor ! generic/temporary correction factor character(len=*), parameter :: subname='(datm_datamode_jra): ' !------------------------------------------------------------------------------- @@ -254,7 +252,7 @@ end subroutine datm_datamode_jra_advance !=============================================================================== subroutine datm_datamode_jra_restart_write(case_name, inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) ! input/output variables character(len=*) , intent(in) :: case_name @@ -263,12 +261,11 @@ subroutine datm_datamode_jra_restart_write(case_name, inst_suffix, ymd, tod, & integer , intent(in) :: tod ! model sec into model date integer , intent(in) :: logunit integer , intent(in) :: my_task - integer , intent(in) :: mpicom type(shr_strdata_type) , intent(inout) :: sdat !------------------------------------------------------------------------------- call dshr_restart_write(rpfile, case_name, 'datm', inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) end subroutine datm_datamode_jra_restart_write diff --git a/dice/CMakeLists.txt b/dice/CMakeLists.txt index 841ddd71e..f45a446b3 100644 --- a/dice/CMakeLists.txt +++ b/dice/CMakeLists.txt @@ -17,4 +17,4 @@ target_include_directories (dice PUBLIC "${CMAKE_BINARY_DIR}/dshr") target_include_directories (dice PUBLIC "${CMAKE_SOURCE_DIR}") target_include_directories (dice PUBLIC "${CMAKE_BINARY_DIR}/share") target_include_directories (dice PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (dice PUBLIC "${PIO_INCDIR}") +target_include_directories (dice PUBLIC "${PIO_Fortran_INCLUDE_DIR}") diff --git a/dice/cime_config/buildnml b/dice/cime_config/buildnml index a5917b413..7b925d5b4 100755 --- a/dice/cime_config/buildnml +++ b/dice/cime_config/buildnml @@ -1,6 +1,6 @@ #!/usr/bin/env python -"""Namelist creator for CIME's data ice model. +"""Namelist creator for CDEPS data ice model. """ # Typically ignore this. @@ -11,8 +11,13 @@ import os, sys -_CIMEROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..","..","..","..","..") -sys.path.append(os.path.join(_CIMEROOT, "scripts", "Tools")) +_CDEPS_CONFIG = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,os.pardir,"cime_config") +_CIMEROOT = os.environ.get("CIMEROOT") +if _CIMEROOT is None: + raise SystemExit("ERROR: must set CIMEROOT environment variable") +_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") +sys.path.append(_LIBDIR) +sys.path.append(_CDEPS_CONFIG) from standard_script_setup import * from CIME.case import Case @@ -20,6 +25,7 @@ from CIME.XML.files import Files from CIME.nmlgen import NamelistGenerator from CIME.utils import expect, safe_copy from CIME.buildnml import create_namelist_infile, parse_input, copy_inputs_to_rundir +from stream_cdeps import StreamCDEPS logger = logging.getLogger(__name__) @@ -38,7 +44,6 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path # Write out dice_in and dice.streams.xml #---------------------------------------------------- - caseroot = case.get_value("CASEROOT") dice_mode = case.get_value("DICE_MODE") ice_grid = case.get_value("ICE_GRID") ice_nx = case.get_value("ICE_NX") @@ -63,6 +68,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path scol_mode = True if case.get_value('PTS_MODE') else False config['set_model_maskfile'] = 'true' if scol_mode or (ice_nx==atm_nx and ice_ny==atm_ny) else 'false' + # Initialize nmlgen nmlgen.init_defaults(infile, config) # Generate dice_in @@ -70,9 +76,12 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path nmlgen.write_output_file(namelist_file, data_list_path, groups=['dice_nml']) # Generate dice.streams.xml - streams = nmlgen.get_streams() - stream_path = os.path.join(confdir, "dice.streams"+inst_string+".xml" ) - nmlgen.create_nuopc_stream_files(config, caseroot, streams, stream_path, data_list_path) + streamlist = nmlgen.get_streams() + stream_file = os.path.join(_CDEPS_CONFIG,os.pardir, "dice","cime_config","stream_definition_dice.xml") + schema_file = os.path.join(_CDEPS_CONFIG,"streams_v2.0.xsd") + streams = StreamCDEPS(stream_file, schema_file) + outfile = os.path.join(confdir, "dice.streams"+inst_string+".xml" ) + streams.create_stream_xml(streamlist, case, outfile, data_list_path) ############################################################################### def buildnml(case, caseroot, compname): diff --git a/dice/cime_config/namelist_definition_dice.xml b/dice/cime_config/namelist_definition_dice.xml index 86e4b24d2..fe18d508a 100644 --- a/dice/cime_config/namelist_definition_dice.xml +++ b/dice/cime_config/namelist_definition_dice.xml @@ -4,23 +4,10 @@ - - - - + + char(100) + streams + streams_file + List of streams used for the given dice_mode. + + ssmi_iaf + ssmi_nyf + + char @@ -52,302 +46,12 @@ - - - - - - char(100) - streams - streams_file - List of streams used for the given dice_mode. - - ssmi - ssmi_iaf - - - - - char - streams - derived - stream mesh (appears in the stream xml file) - - - $DIN_LOC_ROOT/ice/dice7/SSMI/ssmi.ifrac.0.5x0.5_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5_ESMFmesh_120520.nc - - - - - - char - streams - derived - stream data files (appears in the stream xml files) - - - null - - - $DIN_LOC_ROOT/ice/dice7/SSMI/ssmi_ifrac.clim.x0.5.090319.nc - - - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1948.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1949.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1950.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1951.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1952.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1953.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1954.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1955.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1956.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1957.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1958.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1959.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1960.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1961.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1962.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1963.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1964.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1965.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1966.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1967.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1968.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1969.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1970.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1971.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1972.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1973.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1974.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1975.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1976.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1977.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1978.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1979.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1980.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1981.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1982.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1983.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1984.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1985.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1986.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1987.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1988.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1989.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1990.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1991.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1992.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1993.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1994.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1995.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1996.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1997.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1998.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.1999.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.2000.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.2001.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.2002.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.2003.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.2004.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.2005.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.2006.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.2007.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.2008.20120420.nc - $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.2009.20120420.nc - - - - - - char - streams - streams_file - Stream data variable name(s) (this appears in the stream xml file) - - - ifrac Si_ifrac - - - - - - integer - streams - streams_file - Stream offset (this appears in the stream xml file) - - 0 - - - - - integer - streams - streams_file - Simulation year to align stream to. - - -999 - 1 - 1 - - - - - integer - streams - streams_file - First year of stream. - - -999 - 1 - 1948 - - - - - integer - streams - streams_file - Last year of stream. - - -999 - 1 - 2009 - - - - - char(30) - streams - streams_file - copy,bilinear,nn,nnoni,nnonj,spval - - array (up to 30 elements) of fill algorithms associated with the array - of streams. valid options are copy by index, set to special value, - nearest neighbor, nearest neighbor in "i" direction, nearest neighbor - in "j" direction, or bilinear. - valid values: copy,spval,nn,nnoni,nnonj,bilinear - - - bilinear - - - - - char(30) - streams - streams_file - coszen,nearest,linear,lower,upper - - array (up to 30 elements) of time interpolation options associated with the array of - streams. - valid values: lower,upper,nearest,linear,coszen - lower = Use lower time-value - upper = Use upper time-value - nearest = Use the nearest time-value - linear = Linearly interpolate between the two time-values - coszen = Scale according to the cosine of the solar zenith angle (for solar) - - - linear - - - - - char(30) - streams - streams_file - extend,cycle,limit - - array of time axis modes associated with the array of streams for - handling data outside the specified stream time axis. - valid options are to cycle the data based on the first, last, and - align settings associated with the stream dataset, to extend the first - and last valid value indefinitely, or to limit the interpolated data - to fall only between the least and greatest valid value of the time array. - valid values: cycle,extend,limit - extend = extrapolate before and after the period by using the first or last value. - cycle = cycle between the range of data - limit = restrict to the period for which the data is valid - - - cycle - - - - - char(30) - streams - streams_file - single,full_file - - array (up to 30 elements) of reading mode associated with the array of - streams. specifies the mode of reading temporal stream dataset. - valid options are "single" (read temporal dataset one at a time) or - "full_file" (read all entires of temporal dataset in a given netcdf file) - valid values: single,full_file - - - single - - - - - real(30) - streams - streams_file - - array (up to 30 elements) of delta time ratio limits placed on the - time interpolation associated with the array of streams. this real - value causes the model to stop if the ratio of the running maximum - delta time divided by the minimum delta time is greater than the - dtlimit for that stream. for instance, with daily data, the delta - time should be exactly one day throughout the dataset and the computed - maximum divided by minimum delta time should always be 1.0. for - monthly data, the delta time should be between 28 and 31 days and the - maximum ratio should be about 1.1. the running value of the delta - time is computed as data is read and any wraparound or cycling is also - included. this input helps trap missing data or errors in cycling. - to turn off trapping, set the value to 1.0e30 or something similar. - - - 1.5e0 - - - - - char - streams - streams_file - - list of paired colon delimited field names that should be treated as - vectors when carrying out spatial interpolation. unlike other - character arrays in this namelist, this array is completely decoupled - from the list of streams. this is a list of vector pairs that span - all input streams where different fields of the vector pair could - appear in different streams. - for example, vectors = 'u:v','taux:tauy'. - - - null - - - - - - - - + char streams abs dice_nml - - file specifying model mesh - + file specifying model mesh $ICE_DOMAIN_MESH null @@ -376,9 +80,7 @@ streams abs dice_nml - - file specifying model mesh - + file specifying if model mesh is to be created at runtime null $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE diff --git a/dice/cime_config/stream_definition_dice.xml b/dice/cime_config/stream_definition_dice.xml new file mode 100644 index 000000000..553065ab4 --- /dev/null +++ b/dice/cime_config/stream_definition_dice.xml @@ -0,0 +1,70 @@ + + + + + + + + + $DIN_LOC_ROOT/ice/dice7/SSMI/ssmi.ifrac.0.5x0.5_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/ice/dice7/SSMI/ssmi_ifrac.clim.x0.5.090319.nc + + + ifrac Si_ifrac + + null + + bilinear + + null + 1 + 1 + 1 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.%y.nc + $DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5.%y.20120420.nc + + + ifrac Si_ifrac + + null + + bilinear + + null + 1 + 1948 + 2009 + 0 + + linear + + + cycle + + + 1.5 + + single + + + diff --git a/dice/dice_datamode_ssmi_mod.F90 b/dice/dice_datamode_ssmi_mod.F90 index e62942efa..090c4f10c 100644 --- a/dice/dice_datamode_ssmi_mod.F90 +++ b/dice/dice_datamode_ssmi_mod.F90 @@ -127,7 +127,6 @@ subroutine dice_datamode_ssmi_advertise(importState, exportState, fldsimport, fl integer , intent(out) :: rc ! local variables - integer :: n type(fldlist_type), pointer :: fldList !------------------------------------------------------------------------------- @@ -569,7 +568,7 @@ end subroutine dice_datamode_ssmi_advance !=============================================================================== subroutine dice_datamode_ssmi_restart_write(case_name, inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) ! input/output variables character(len=*) , intent(in) :: case_name @@ -578,12 +577,11 @@ subroutine dice_datamode_ssmi_restart_write(case_name, inst_suffix, ymd, tod, & integer , intent(in) :: tod ! model sec into model date integer , intent(in) :: logunit integer , intent(in) :: my_task - integer , intent(in) :: mpicom type(shr_strdata_type) , intent(inout) :: sdat !------------------------------------------------------------------------------- call dshr_restart_write(rpfile, case_name, 'dice', inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat, fld=water, fldname='water') + logunit, my_task, sdat, fld=water, fldname='water') end subroutine dice_datamode_ssmi_restart_write diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index ce11df850..05ede8161 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -23,7 +23,6 @@ module ice_comp_nuopc use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_xml, shr_strdata_advance use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize - use perf_mod , only : t_startf, t_stopf, t_adj_detailf, t_barrierf use dice_datamode_ssmi_mod , only : dice_datamode_ssmi_advertise use dice_datamode_ssmi_mod , only : dice_datamode_ssmi_init_pointers @@ -205,7 +204,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logunit,F01)' ny_global = ',ny_global write(logunit,F03)' flux_swpf = ',flux_swpf write(logunit,F03)' flux_Qmin = ',flux_Qmin - write(logunit,F03)' flux_Qacc = ',flux_Qacc + write(logunit,F02)' flux_Qacc = ',flux_Qacc write(logunit,F03)' flux_Qacc0 = ',flux_Qacc0 write(logunit,F00)' restfilm = ',trim(restfilm) @@ -286,8 +285,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: current_tod ! model sec into model date real(R8) :: cosarg ! for setting ice temp pattern real(R8) :: jday, jday0 ! elapsed day counters - character(CL) :: cvalue ! temporary - integer :: n,k ! generic counters integer :: model_dt ! integer model timestep character(len=*), parameter :: F00 = "('ice_comp_nuopc: ')',8a)" character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' @@ -296,7 +293,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) rc = ESMF_SUCCESS ! Initialize mesh, restart flag, logunit - call t_startf('dice_strdata_init') + call ESMF_TraceRegionEnter('dice_strdata_init') call dshr_mesh_init(gcomp, nullstr, logunit, 'ICE', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) @@ -306,7 +303,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) xmlfilename = 'dice.streams'//trim(inst_suffix)//'.xml' call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'ICE', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('dice_strdata_init') + call ESMF_TraceRegionExit('dice_strdata_init') ! NUOPC_Realize "realizes" a previously advertised field in the importState and exportState ! by replacing the advertised fields with the newly created fields of the same name. @@ -359,9 +356,6 @@ subroutine ModelAdvance(gcomp, rc) type(ESMF_Alarm) :: alarm type(ESMF_TimeInterval) :: timeStep type(ESMF_Time) :: currTime, nextTime - integer :: current_mon ! model month - integer :: current_day ! model day - integer :: current_tod ! model sec into model date real(R8) :: cosarg ! for setting ice temp pattern real(R8) :: jday, jday0 ! elapsed day counters integer :: next_ymd ! model date @@ -375,7 +369,7 @@ subroutine ModelAdvance(gcomp, rc) rc = ESMF_SUCCESS - call t_startf(subname) + call ESMF_TraceRegionEnter(subname) call memcheck(subname, 5, my_task == master_task) ! Query the Component for its clock, importState and exportState @@ -413,7 +407,7 @@ subroutine ModelAdvance(gcomp, rc) call dice_comp_run(importState, exportState, next_ymd, next_tod, cosarg, restart_write, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf(subname) + call ESMF_TraceRegionExit(subname) end subroutine ModelAdvance @@ -440,7 +434,7 @@ subroutine dice_comp_run(importstate, exportstate, target_ymd, target_tod, cosar rc = ESMF_SUCCESS - call t_startf('DICE_RUN') + call ESMF_TraceRegionEnter('DICE_RUN') !-------------------- ! first time initialization @@ -477,27 +471,27 @@ subroutine dice_comp_run(importstate, exportstate, target_ymd, target_tod, cosar !-------------------- ! time and spatially interpolate to model time and grid - call t_barrierf('dice_BARRIER',mpicom) - call t_startf('dice_strdata_advance') + + call ESMF_TraceRegionEnter('dice_strdata_advance') call shr_strdata_advance(sdat, target_ymd, target_tod, logunit, 'dice', rc=rc) - call t_stopf('dice_strdata_advance') + call ESMF_TraceRegionExit('dice_strdata_advance') !-------------------- ! copy all fields from streams to export state as default !-------------------- ! This automatically will update the fields in the export state - call t_barrierf('dice_comp_dfield_copy_BARRIER', mpicom) - call t_startf('dice_dfield_copy') + + call ESMF_TraceRegionEnter('dice_dfield_copy') call dshr_dfield_copy(dfields, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('dice_dfield_copy') + call ESMF_TraceRegionExit('dice_dfield_copy') !------------------------------------------------- ! Determine data model behavior based on the mode !------------------------------------------------- - call t_startf('dice_datamode') + call ESMF_TraceRegionEnter('dice_datamode') ! Perform data mode specific calculations select case (trim(datamode)) @@ -512,7 +506,7 @@ subroutine dice_comp_run(importstate, exportstate, target_ymd, target_tod, cosar select case (trim(datamode)) case('ssmi', 'ssmi_iaf') call dice_datamode_ssmi_restart_write(case_name, inst_suffix, target_ymd, target_tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) if (ChkErr(rc,__LINE__,u_FILE_u)) return end select end if @@ -523,8 +517,8 @@ subroutine dice_comp_run(importstate, exportstate, target_ymd, target_tod, cosar if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - call t_stopf('dice_datamode') - call t_stopf('DICE_RUN') + call ESMF_TraceRegionExit('dice_datamode') + call ESMF_TraceRegionExit('DICE_RUN') end subroutine dice_comp_run diff --git a/dlnd/CMakeLists.txt b/dlnd/CMakeLists.txt index 03a81ac0e..ae080d307 100644 --- a/dlnd/CMakeLists.txt +++ b/dlnd/CMakeLists.txt @@ -16,4 +16,4 @@ target_include_directories (dlnd PUBLIC "${CMAKE_BINARY_DIR}/dshr") target_include_directories (dlnd PUBLIC "${CMAKE_SOURCE_DIR}") target_include_directories (dlnd PUBLIC "${CMAKE_BINARY_DIR}/share") target_include_directories (dlnd PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (dlnd PUBLIC "${PIO_INCDIR}") +target_include_directories (dlnd PUBLIC "${PIO_Fortran_INCLUDE_DIR}") diff --git a/dlnd/cime_config/buildnml b/dlnd/cime_config/buildnml index 774d12fe9..998959374 100755 --- a/dlnd/cime_config/buildnml +++ b/dlnd/cime_config/buildnml @@ -11,8 +11,13 @@ import os, sys -_CIMEROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..","..","..","..","..") -sys.path.append(os.path.join(_CIMEROOT, "scripts", "Tools")) +_CDEPS_CONFIG = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,os.pardir,"cime_config") +_CIMEROOT = os.environ.get("CIMEROOT") +if _CIMEROOT is None: + raise SystemExit("ERROR: must set CIMEROOT environment variable") +_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") +sys.path.append(_LIBDIR) +sys.path.append(_CDEPS_CONFIG) from standard_script_setup import * from CIME.case import Case @@ -20,6 +25,7 @@ from CIME.nmlgen import NamelistGenerator from CIME.utils import expect, safe_copy from CIME.XML.files import Files from CIME.buildnml import create_namelist_infile, parse_input, copy_inputs_to_rundir +from stream_cdeps import StreamCDEPS logger = logging.getLogger(__name__) @@ -62,17 +68,20 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path expect(not scol_mode, "for DLND, single column mode is not allowed") - # initialize nmlgen + # Initialize nmlgen nmlgen.init_defaults(infile, config) # Generate dlnd_in namelist_file = os.path.join(confdir, "dlnd_in") nmlgen.write_output_file(namelist_file, data_list_path, groups=['dlnd_nml']) - # Generate dlnd.stream.xml - streams = nmlgen.get_streams() - stream_path = os.path.join(confdir, "dlnd.streams"+inst_string+".xml" ) - nmlgen.create_nuopc_stream_files(config, caseroot, streams, stream_path, data_list_path) + # Generate dlnd.streams.xml + streamlist = nmlgen.get_streams() + stream_file = os.path.join(_CDEPS_CONFIG,os.pardir, "dlnd","cime_config","stream_definition_dlnd.xml") + schema_file = os.path.join(_CDEPS_CONFIG,"streams_v2.0.xsd") + streams = StreamCDEPS(stream_file, schema_file) + outfile = os.path.join(confdir, "dlnd.streams"+inst_string+".xml" ) + streams.create_stream_xml(streamlist, case, outfile, data_list_path) ############################################################################### def buildnml(case, caseroot, compname): diff --git a/dlnd/cime_config/namelist_definition_dlnd.xml b/dlnd/cime_config/namelist_definition_dlnd.xml index faa840bda..954dd84f6 100644 --- a/dlnd/cime_config/namelist_definition_dlnd.xml +++ b/dlnd/cime_config/namelist_definition_dlnd.xml @@ -6,47 +6,11 @@ - - - - - - char - dlnd - dlnd_nml - copyall - - Copies all fields directly from the input data streams Any required - fields not found on an input stream will be set to zero. - - - copyall - - - - - - - char(100) streams @@ -58,201 +22,21 @@ - - char - streams - streams_file - Stream domain file directory. - - $LND_DOMAIN_MESH - - - - - char - streams - streams_file - Stream data file path(s). - - $DLND_CPLHIST_DIR/$DLND_CPLHIST_CASE.cpl.hl2x1yr_glc.%y-01-01.nc - - - - - char - streams - streams_file - Stream data variable name(s). - - - l2x1yr_glc_Sl_tsrf%glc Sl_tsrf_elev%glc - l2x1yr_glc_Sl_topo%glc Sl_topo_elev%glc - l2x1yr_glc_Flgl_qice%glc Flgl_qice_elev%glc - - - - - - integer - streams - streams_file - Stream offset. - - 0 - - - - - integer - streams - streams_file - Simulation year to align stream to. - - $DLND_CPLHIST_YR_ALIGN - - - - - integer - streams - streams_file - First year of stream. - - $DLND_CPLHIST_YR_START - - - - - integer - streams - streams_file - Last year of stream. - - $DLND_CPLHIST_YR_END - - - - - char(30) - streams - streams_file - bilinear,nn - - fill algorithms associated with the array of streams. - valid values: nn,bilinear - - - bilinear - - - - - char(30) - streams - streams_file - coszen,nearest,linear,lower,upper - - time interpolation options associated with the array of - streams. - valid values: lower,upper,nearest,linear,coszen - lower = Use lower time-value - upper = Use upper time-value - nearest = Use the nearest time-value - linear = Linearly interpolate between the two time-values - coszen = Scale according to the cosine of the solar zenith angle (for solar) - - - linear - lower - - - - - char(30) - streams - streams_file - extend,cycle,limit - - array of time axis modes associated with the array of streams for - handling data outside the specified stream time axis. - valid options are to cycle the data based on the first, last, and - align settings associated with the stream dataset, to extend the first - and last valid value indefinitely, or to limit the interpolated data - to fall only between the least and greatest valid value of the time array. - valid values: cycle,extend,limit - extend = extrapolate before and after the period by using the first or last value. - cycle = cycle between the range of data - limit = restrict to the period for which the data is valid - - - cycle - - - - - char(30) - streams - streams_file - single,full_file - - reading mode associated with the array of streams. - specifies the mode of reading temporal stream dataset. - valid options are - "single" (read temporal dataset one at a time) or - "full_file" (read all entires of temporal dataset in a given netcdf file) - valid values: single,full_file - - - single - - - - - real(30) - streams - streams_file - - delta time ratio limits placed on the - time interpolation associated with the array of streams. this real - value causes the model to stop if the ratio of the running maximum - delta time divided by the minimum delta time is greater than the - dtlimit for that stream. for instance, with daily data, the delta - time should be exactly one day throughout the dataset and the computed - maximum divided by minimum delta time should always be 1.0. for - monthly data, the delta time should be between 28 and 31 days and the - maximum ratio should be about 1.1. the running value of the delta - time is computed as data is read and any wraparound or cycling is also - included. this input helps trap missing data or errors in cycling. - to turn off trapping, set the value to 1.0e30 or something similar. - - - 1.5e0 - - - - + char - streams - streams_file + dlnd + dlnd_nml + copyall - list of paired colon delimited field names that should be treated as - vectors when carrying out spatial interpolation. unlike other - character arrays in this namelist, this array is completely decoupled - from the list of streams. this is a list of vector pairs that span - all input streams where different fields of the vector pair could - appear in different streams. - for example, vectors = 'u:v','taux:tauy'. + Copies all fields directly from the input data streams Any required + fields not found on an input stream will be set to zero. - null + copyall - - - - - + char streams abs diff --git a/dlnd/cime_config/stream_definition_dlnd.xml b/dlnd/cime_config/stream_definition_dlnd.xml new file mode 100644 index 000000000..74ec272fe --- /dev/null +++ b/dlnd/cime_config/stream_definition_dlnd.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + $LND_DOMAIN_MESH + + + $DLND_CPLHIST_DIR/$DLND_CPLHIST_CASE.cpl.hl2x1yr_glc.%y-01-01.nc + + + l2x1yr_glc_Sl_tsrf%glc Sl_tsrf_elev%glc + l2x1yr_glc_Sl_topo%glc Sl_topo_elev%glc + l2x1yr_glc_Flgl_qice%glc Flgl_qice_elev%glc + + null + + bilinear + + null + $DLND_CPLHIST_YR_ALIGN + $DLND_CPLHIST_YR_START + $DLND_CPLHIST_YR_END + 0 + + lower + + + cycle + + + 1.5 + + single + + + diff --git a/dlnd/lnd_comp_nuopc.F90 b/dlnd/lnd_comp_nuopc.F90 index 6d86145df..ad9455ff3 100644 --- a/dlnd/lnd_comp_nuopc.F90 +++ b/dlnd/lnd_comp_nuopc.F90 @@ -25,7 +25,6 @@ module lnd_comp_nuopc use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize use glc_elevclass_mod , only : glc_elevclass_as_string, glc_elevclass_init - use perf_mod , only : t_startf, t_stopf, t_adj_detailf, t_barrierf implicit none private ! except @@ -73,7 +72,6 @@ module lnd_comp_nuopc integer :: ny_global ! global ny dimension of model mesh ! linked lists - type(fldList_type) , pointer :: fldsImport => null() type(fldList_type) , pointer :: fldsExport => null() type(dfield_type) , pointer :: dfields => null() @@ -272,14 +270,13 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: current_mon ! model month integer :: current_day ! model day integer :: current_tod ! model sec into model date - character(CL) :: cvalue ! temporary character(len=*),parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS ! Initialize sdat - call t_startf('dlnd_strdata_init') + call ESMF_TraceRegionEnter('dlnd_strdata_init') call dshr_mesh_init(gcomp, nullstr, logunit, 'LND', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) @@ -288,7 +285,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) xmlfilename = 'dlnd.streams'//trim(inst_suffix)//'.xml' call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'LND', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('dlnd_strdata_init') + call ESMF_TraceRegionExit('dlnd_strdata_init') ! Realize the actively coupled fields, now that a mesh is established and ! initialize dfields data type (to map streams to export state fields) @@ -376,10 +373,10 @@ subroutine ModelAdvance(gcomp, rc) call ESMF_AlarmRingerOff( alarm, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_startf('dlnd_restart') + call ESMF_TraceRegionEnter('dlnd_restart') call dshr_restart_write(rpfile, case_name, 'dlnd', inst_suffix, next_ymd, next_tod, & - logunit, mpicom, my_task, sdat) - call t_stopf('dlnd_restart') + logunit, my_task, sdat) + call ESMF_TraceRegionExit('dlnd_restart') endif ! write diagnostics @@ -512,7 +509,7 @@ subroutine dlnd_comp_run(importState, exportState, target_ymd, target_tod, rc) rc = ESMF_SUCCESS - call t_startf('DLND_RUN') + call ESMF_TraceRegionEnter('DLND_RUN') !-------------------- ! set module pointers @@ -561,29 +558,27 @@ subroutine dlnd_comp_run(importState, exportState, target_ymd, target_tod, rc) !-------------------- ! time and spatially interpolate to model time and grid - call t_barrierf('dlnd_BARRIER',mpicom) - call t_startf('dlnd_strdata_advance') + call ESMF_TraceRegionEnter('dlnd_strdata_advance') call shr_strdata_advance(sdat, target_ymd, target_tod, logunit, 'dlnd', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('dlnd_strdata_advance') + call ESMF_TraceRegionExit('dlnd_strdata_advance') ! copy all fields from streams to export state as default ! This automatically will update the fields in the export state - call t_barrierf('dlnd_comp_strdata_copy_BARRIER', mpicom) - call t_startf('dlnd_strdata_copy') + call ESMF_TraceRegionEnter('dlnd_strdata_copy') call dshr_dfield_copy(dfields, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('dlnd_strdata_copy') + call ESMF_TraceRegionExit('dlnd_strdata_copy') ! determine data model behavior based on the mode - call t_startf('dlnd_datamode') + call ESMF_TraceRegionEnter('dlnd_datamode') select case (trim(datamode)) case('copyall') ! do nothing extra end select - call t_stopf('dlnd_datamode') - call t_stopf('DLND_RUN') + call ESMF_TraceRegionExit('dlnd_datamode') + call ESMF_TraceRegionExit('DLND_RUN') end subroutine dlnd_comp_run diff --git a/doc/Makefile b/doc/Makefile index a5b7e3474..c9ca504c7 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SPHINXPROJ = CMEPS +SPHINXPROJ = CDEPS SOURCEDIR = source BUILDDIR = build diff --git a/doc/source/datm.rst b/doc/source/datm.rst new file mode 100644 index 000000000..2d1c5c49f --- /dev/null +++ b/doc/source/datm.rst @@ -0,0 +1,126 @@ +.. _datm-datamodes: + +Data Atmosphere (DATM) +====================== + +DATM is normally used to provide observational forcing data (or +forcing data produced by a previous run using active components) to +drive prognostic components. The various ways of running DATM is referred to as its mode. + +In the case of CESM, these would be: CTSM, POP2, MOM6, POP2/CICE5-6 +and MOM6/CICE5-6. As examples, CORE2_NYF (CORE2 normal year forcing) +is the DATM mode used in driving POP2 and MOM6. On the other hand +CLM_QIAN, CLMCRUNCEP, CLMGSWP3 and CLM1PT are DATM modes using +observational data for forcing CTSM. + +.. _datm-datamodes: + +-------------------- +datamode values +-------------------- + +DATM its own set of supported ``datamode`` values that appears in the +``datm_in`` namelist input. The datamode specifies what additional +operations need to be done by DATM on *ALL* of the streams in the +``datm.streams.xml`` file. Each datamode value is also associated +with a DATM source file that carries out these operations and these are +listed in parentheses next to the mode name. + +CLMNCEP (``datm_datamode_clmncep_mod.F90``) + - In conjunction with NCEP climatological atmosphere data, provides + the atmosphere forcing favored by the Land Model Working Group when + coupling an active land model with observed atmospheric + forcing. This mode replicates code previously found in CLM (circa + 2005), before the LMWG started using the CIME coupling + infrastructure and data models to do active-land-only simulations." + +CORE2_NYF (``datm_datamode_core2_mod.F90``) + - Coordinated Ocean-ice Reference Experiments (CORE) Version 2 Normal Year Forcing." + +CORE2_IAF (``datm_datamode_core2_mod.F90``) + - In conjunction with CORE Version 2 atmospheric forcing data, + provides the atmosphere forcing when coupling an active ocean model + with observed atmospheric forcing. This mode and associated data + sets implement the CORE-IAF Version 2 forcing data, as developed by + Large and Yeager (2008) at NCAR. Note that CORE2_NYF and CORE2_IAF + work exactly the same way. + +CORE_IAF_JRA (``datm_datamode_jra_mod.F90``) + - In conjunction with JRA-55 Project, provides the atmosphere forcing + when coupling an active ocean model with observed atmospheric + forcing. This mode and associated data sets implement the JRA-55 + v1.3 forcing data." + +ERA5 (``datm_datamode_era5_mod.F90``) + - Fifth generation ECMWF atmospheric reanalysis of the global climate + +.. _datm-cime-vars: + +--------------------------------------- +Configuring DATM from CIME +--------------------------------------- + +If CDEPS is coupled to the CIME-CCS then the CIME ``$CASEMROOT`` xml +variable ``DATM_MODE`` sets the collection of streams the streams that +are associated with DATM and also sets the datm namelist variable +``datamode`` in the file ``datm_in``. The following are the supported +DATM ``datamode`` values, as defined in the file +``namelist_definition_datm.xml``. + +The following table describes the valid values of ``DATM_MODE`` +(defined in the ``config_component.xml`` file for DATM), and how they +relate to the associated input streams and the ``datamode`` namelist +variable. CIME will generate a value of ``DATM_MODE`` based on the +compset. + +CORE2_NYF, + - CORE2 normal year forcing (CESM C ang G compsets) + - streams: CORE2_NYF.GISS,CORE2_NYF.GXGXS,CORE2_NYF.NCEP + - datamode: CORE2_NYF + +CORE2_IAF + - CORE2 interannual year forcing (CESM C ang G compsets) + - streams: CORE2_IAF.GCGCS.PREC,CORE2_IAF.GISS.LWDN, + CORE2_IAF.GISS.SWDN,CORE2_IAF.GISS.SWUP, + CORE2_IAF.NCEP.DN10,CORE2_IAF.NCEP.Q_10, + CORE2_IAF.NCEP.SLP_,CORE2_IAF.NCEP.T_10,CORE2_IAF.NCEP.U_10, + CORE2_IAF.NCEP.V_10,CORE2_IAF.CORE2.ArcFactor + - datamode: CORE2_IAF + +CORE_IAF_JRA + - JRA-55 intra-annual year forcing (CESM C ang G compsets) + - streams: CORE_IAF_JRA.PREC,CORE_IAF_JRA.LWDN,CORE_IAF_JRA.SWDN, + CORE_IAF_JRA.Q_10,CORE_IAF_JRA.SLP_,CORE_IAF_JRA.T_10,CORE_IAF_JRA.U_10, + CORE_IAF_JRA.V_10,CORE_IAF_JRA.CORE2.ArcFactor + - datamode: CORE_IAF_JRA + +CLM_QIAN_WISO + - QIAN atm input data with water isotopes (CESM I compsets) + - streams: CLM_QIAN_WISO.Solar,CLM_QIAN_WISO.Precip,CLM_QIAN_WISO.TPQW + - datamode: CLMNCEP + +CLM_QIAN + - QIAN atm input data (CESM I compsets) + - streams: CLM_QIAN.Solar,CLM_QIAN.Precip,CLM_QIAN.TPQW + - datamode: CLMNCEP + +CLMCRUNCEPv7 + - CRUNCEP atm input data (CESM I compsets) + - streams: CLMCRUNCEP.Solar,CLMCRUNCEP.Precip,CLMCRUNCEP.TPQW + - datamode: CLMNCEP + +CLMGSWP3 + - GSWP3 atm input data (I compsets) + - streams: CLMGSWP3.Solar,CLMGSWP3.Precip,CLMGSWP3.TPQW + - datamode: CLMNCEP + +CLM1PT + - single point tower site atm input data + - streams: CLM1PT.$ATM_GRID + - datamode: CLMNCEP + +CPLHIST + - user generated forcing data from using coupler history files + used to spinup relevant prognostic components (for CESM this is CLM, POP and CISM) + - streams: CPLHISTForcing.Solar,CPLHISTForcing.nonSolarFlux, + - datamode: CPLHIST diff --git a/doc/source/design_details.rst b/doc/source/design_details.rst new file mode 100644 index 000000000..965d3d581 --- /dev/null +++ b/doc/source/design_details.rst @@ -0,0 +1,210 @@ +.. _design-details: + +================ + Design Details +================ + +---------------------- +Data Model Performance +---------------------- + +There are two primary costs associated with CDEPS share code: reading data and spatially mapping data. +Time interpolation is relatively cheap in the current implementation. +As much as possible, redundant operations are minimized. +The upper and lower bound mapped input data is saved between time steps to reduce mapping costs in cases where data is time interpolated more often than new data is read. +If the input data timestep is relatively small (for example, hourly data as opposed to daily or monthly data) the cost of reading input data can be quite large. +Also, there can be significant variation in cost of the data model over the coarse of the run, for instance, when new inputdata must be read and interpolated, although it's relatively predictable. +The present implementation doesn't support changing the order of operations, for instance, time interpolating the data before spatial mapping. +Because the present computations are always linear, changing the order of operations will not fundamentally change the results. +The present order of operations generally minimizes the mapping cost for typical data model use cases. + +---------------------- +IO Through Data Models +---------------------- + +At the present time, data models can only read netcdf data, and IO is handled through the PIO library using either netcdf or pnetcdf. +PIO can read the data either serially or in parallel in chunks that are approximately the global field size divided by the number of IO tasks. +If pnetcdf is used through PIO, then the pnetcdf library must be included during the build of the model. + +---------------------------------- +IO Through Data Models In CIME-CCS +---------------------------------- + +If CDEPS is used in CIME, the pnetcdf path and option is hardwired +into the ``Macros.make`` file for the specific machine. To turn on +``pnetcdf`` in the build, make sure the ``Macros.make`` variables +``PNETCDF_PATH``, ``INC_PNETCDF``, and ``LIB_PNETCDF`` are set and +that the PIO ``CONFIG_ARGS`` sets the ``PNETCDF_PATH`` argument. +Beyond just the option of selecting IO with PIO, several namelist variables are available to help optimize PIO IO performance. +Those are **TODO** - list these. +The total mpi tasks that can be used for IO is limited to the total number of tasks used by the data model. +Often though, using fewer IO tasks results in improved performance. +In general, [io_root + (num_iotasks-1)*io_stride + 1] has to be less than the total number of data model tasks. +In practice, PIO seems to perform optimally somewhere between the extremes of 1 task and all tasks, and is highly machine and problem dependent. + +------------- +Restart Files +------------- +Restart files are generated automatically by the data models based on an attribute flag received in the NUOPC cap. +The restart files must meet the CIME-CCS naming convention and an ``rpointer`` file is generated at the same time. +An ``rpointer`` file is a *restart pointer* file which contains the name of the most recently created restart file. +Normally, if restart files are read, the restart filenames are specified in the ``rpointer`` file. +Optionally though, there are namelist variables such as ``restfilm`` to specify the restart filenames via namelist. If those namelist variables are set, the ``rpointer`` file will be ignored. + +In most cases, no restart file is required for the data models to restart exactly. +This is because there is no memory between timesteps in many of the data model science modes. +If a restart file is required, it will be written automatically and then must be used to continue the previous run. + +There are separate stream restart files that only exist for +performance reasons. A stream restart file contains information about +the time axis of the input streams. This information helps reduce the +startup costs associated with reading the input dataset time axis +information. If a stream restart file is missing, the code will +restart without it but may need to reread data from the input data +files that would have been stored in the stream restart file. This +will take extra time but will not impact the results. + +.. _data-structures: + +--------------- +Stream Modules +--------------- + +The CDEPS stream code contains four modules: + +**dshr_strdata_mod.F90** + Carries out stream IO along with the spatial and + temporal interpolation of the stream data to the model mesh and + model time. Initializes the module data type ``shr_strdata_type``. + +**dshr_stream_mod.F90** + Reads in the stream xml file and returns the upper and + lower bounds of the stream data. Initializes the module data type + ``shr_stream_streamType``. + +**dshr_tinterp_mod.F90** + Determines the time interpolation factors. + +**dshr_methods_mod.F90** + Wrappers to ESMF such as getting a pointer to a field in a field bundle, etc. + +---------------- +Stream Datatypes +---------------- + +The most basic type, ``shr_stream_fileType`` is contained in +``shr_stream_mod.F90`` and specifies basic information related to a +given stream file. + +.. code-block:: Fortran + + type shr_stream_fileType + character(SHR_KIND_CL) :: name = shr_stream_file_null ! the file name + logical :: haveData = .false. ! has t-coord data been read in? + integer (SHR_KIND_IN) :: nt = 0 ! size of time dimension + integer (SHR_KIND_IN),allocatable :: date(:) ! t-coord date: yyyymmdd + integer (SHR_KIND_IN),allocatable :: secs(:) ! t-coord secs: elapsed on date + end type shr_stream_fileType + +The following type, ``shr_stream_streamType`` contains information +that encapsulates the information related to all files specific to a +target stream. (see the overview of the :ref:`stream_description_file`). + +.. code-block:: Fortran + + type shr_stream_streamType + !private ! no public access to internal components + integer :: logunit ! stdout log unit + type(iosystem_desc_t), pointer :: pio_subsystem + integer :: pio_iotype + integer :: pio_ioformat + logical :: init = .false. ! has stream been initialized + integer :: nFiles = 0 ! number of data files + integer :: yearFirst = -1 ! first year to use in t-axis (yyyymmdd) + integer :: yearLast = -1 ! last year to use in t-axis (yyyymmdd) + integer :: yearAlign = -1 ! align yearFirst with this model year + character(CS) :: taxMode = shr_stream_taxis_cycle ! cycling option for time axis + character(CS) :: tInterpAlgo = 'linear' ! algorithm to use for time interpolation + character(CS) :: mapalgo = 'bilinear' ! type of mapping - default is 'bilinear' + character(CS) :: readMode = 'single' ! stream read model - 'single' or 'full_file' + real(r8) :: dtlimit = 1.5_r8 ! delta time ratio limits for time interpolation + integer :: offset = 0 ! offset in seconds of stream data + character(CS) :: calendar = shr_cal_noleap ! stream calendar (obtained from first stream data file) + character(CL) :: meshFile = ' ' ! filename for mesh for all fields on stream (full pathname) + integer :: k_lvd = -1 ! file/sample of least valid date + integer :: n_lvd = -1 ! file/sample of least valid date + logical :: found_lvd = .false. ! T <=> k_lvd,n_lvd have been set + integer :: k_gvd = -1 ! file/sample of greatest valid date + integer :: n_gvd = -1 ! file/sample of greatest valid date + logical :: found_gvd = .false. ! T <=> k_gvd,n_gvd have been set + logical :: fileopen = .false. ! is current file open + character(CL) :: currfile = ' ' ! current filename + integer :: nvars ! number of stream variables + character(CL) :: stream_vectors ! stream vectors names + type(file_desc_t) :: currpioid ! current pio file desc + type(shr_stream_file_type) , allocatable :: file(:) ! filenames of stream data files (full pathname) + type(shr_stream_data_variable), allocatable :: varlist(:) ! stream variable names (on file and in model) + end type shr_stream_streamType + +Finally, the datatypes ``shr_strdata_per_stream`` and +``shr_strdata_type`` in ``dshr_strdata_mod.F90`` are at the heart +of the CDEPS stream code and contains information for +all the streams that are active for the target data model. + +.. code-block:: Fortran + + type shr_strdata_perstream + character(CL) :: stream_meshfile ! stream mesh file from stream txt file + type(ESMF_Mesh) :: stream_mesh ! stream mesh created from stream mesh file + type(io_desc_t) :: stream_pio_iodesc ! stream pio descriptor + logical :: stream_pio_iodesc_set =.false. ! true=>pio iodesc has been set + type(ESMF_RouteHandle) :: routehandle ! stream n -> model mesh mapping + character(CL), allocatable :: fldlist_stream(:) ! names of stream file fields + character(CL), allocatable :: fldlist_model(:) ! names of stream model fields + integer :: stream_lb ! index of the Lowerbound (LB) in fldlist_stream + integer :: stream_ub ! index of the Upperbound (UB) in fldlist_stream + type(ESMF_Field) :: field_stream ! a field on the stream data domain + type(ESMF_Field) :: stream_vector ! a vector field on the stream data domain + type(ESMF_FieldBundle), allocatable :: fldbun_data(:) ! stream field bundle interpolated to model grid + type(ESMF_FieldBundle) :: fldbun_model ! stream n field bundle interpolated to model grid and time + integer :: ucomp = -1 ! index of vector u in stream + integer :: vcomp = -1 ! index of vector v in stream + integer :: ymdLB = -1 ! stream ymd lower bound + integer :: todLB = -1 ! stream tod lower bound + integer :: ymdUB = -1 ! stream ymd upper bound + integer :: todUB = -1 ! stream tod upper bound + real(r8) :: dtmin = 1.0e30_r8 + real(r8) :: dtmax = 0.0_r8 + type(ESMF_Field) :: field_coszen ! needed for coszen time interp + end type shr_strdata_perstream + +.. code-block:: Fortran + + type shr_strdata_type + type(shr_strdata_perstream), allocatable :: pstrm(:) ! stream info + type(shr_stream_streamType), pointer :: stream(:)=> null() ! stream datatype + integer :: nvectors ! number of vectors + logical :: masterproc + integer :: logunit ! stdout unit + integer :: io_type ! pio info + integer :: io_format ! pio info + integer :: modeldt = 0 ! model dt in seconds + type(ESMF_Mesh) :: model_mesh ! model mesh + real(r8), pointer :: model_lon(:) => null() ! model longitudes + real(r8), pointer :: model_lat(:) => null() ! model latitudes + integer :: model_nxg ! model global domain lon size + integer :: model_nyg ! model global domain lat size + integer :: model_nzg ! model global domain vertical size + integer :: model_lsize ! model local domain size + integer, pointer :: model_gindex(:) ! model global index spzce + integer :: model_gsize ! model global domain size + type(ESMF_CLock) :: model_clock ! model clock + character(CL) :: model_calendar = shr_cal_noleap ! model calendar for ymd,tod + integer :: ymd, tod ! model time + type(iosystem_desc_t), pointer :: pio_subsystem => null() ! pio info + real(r8) :: eccen = SHR_ORB_UNDEF_REAL ! cosz t-interp info + real(r8) :: mvelpp = SHR_ORB_UNDEF_REAL ! cosz t-interp info + real(r8) :: lambm0 = SHR_ORB_UNDEF_REAL ! cosz t-interp info + real(r8) :: obliqr = SHR_ORB_UNDEF_REAL ! cosz t-interp info + real(r8), allocatable :: tavCoszen(:) ! cosz t-interp data + end type shr_strdata_type diff --git a/doc/source/index.rst b/doc/source/index.rst index 443090706..6d81fe430 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -5,11 +5,14 @@ CDEPS documentation =================== -The Community Data Models for Earth Prediction Systems (CMEPS) is a -NUOPC-compliant Mediator component used for coupling Earth system -model components. It is currently being used in NCAR's Community -Earth System Model (CESM) and NOAA's subseasonal-to-seasonal -coupled system. + +The Community Data Models for Earth Predictive Systems (CDEPS) +contains a set of NUOPC-compliant data components along with +ESMF-based share code that enables new capabilities in selectively +removing feedbacks in coupled model systems. The CDEPS data +models perform the basic function of reading external data files, +modifying those data, and then sending the data back to the CMEPS +mediator. Table of contents ----------------- @@ -18,3 +21,6 @@ Table of contents :numbered: introduction.rst + streams.rst + design_details.rst + datm.rst diff --git a/doc/source/introduction.rst b/doc/source/introduction.rst index 8507d8ccb..baf9209e5 100644 --- a/doc/source/introduction.rst +++ b/doc/source/introduction.rst @@ -1,4 +1,130 @@ +.. _data-model-introduction: + Introduction ============ -Content to go here: +-------- +Overview +-------- + +The Community Data Models for Earth Predictive Systems (CDEPS) +contains a set of NUOPC-compliant data components along with +ESMF-based "stream" code that enables new capabilities in selectively +removing feedbacks in coupled model systems. The CDEPS data +models perform the basic function of reading external data files, +modifying those data, and then sending the data back to the CMEPS +mediator. The fields sent to the mediator are the same as those that +would be sent by an active component. This takes advantage of the +fact that the mediator and other CMEPS-compliant model components have +no fundamental knowledge of whether another component is fully active +or just a data component. + +CDEPS is completely ESMF based. As a result, regridding between the +stream resolution and the model resolution can occur at run time for +any regridding option that ESMF supports. In addition, the PIO library +is used so that all of the stream data is read in parallel by the +CDEPS stream code. + +The CDEPS data models typically read gridded data from a variety of sources +including observations, reanalysis products or output data from a +previous model simulation. Out of the box, they often provide a few +possible data sources and/or time periods that you can choose from +when setting up a case. + +In some cases, data models have prognostic functionality, that is, +they also receive and use data sent by the mediator. However, in most +cases, the data models are not running prognostically and have no need +to receive any data from the mediator. + +The CIME data models have parallel capability and share significant +amounts of source code. Methods for reading and interpolating data +have been established and can easily be reused: The data model calls +strdata ("stream data") methods which then call stream methods. The +stream methods are responsible for managing lists of input data files +and their time axes. The information is then passed up to the strdata +methods where the data is read and interpolated in space and time. +The interpolated data is passed up to the data model where final +fields are derived, packed, and returned to the mediator. + +--------- +Code Tree +--------- + +CDEPS contains the following code tree: + +=============== ========================================= +Directory Function +=============== ========================================= +cime_config CIME Case Control System +cmake Build (can be used with or without CIME) +datm data atmosphere component +dice data sea-ice component +dlnd data land component +docn data ocean component +drof data river component +dwav data wave component +dshr shared NUOPC cap code +share shared utility code +streams code to handle streams +=============== ========================================= + +------ +Design +------ + +Data models function by reading in different ``streams`` of input +data. A ``stream`` is defined as a set of data files containing a set +of fields, where all the fields are on the same stream mesh and have +the same time coordinates. Data models input falls into two +categories: stream-independent and stream-dependent data. + +**stream-dependent-data** + Stream-dependent input is contained in the input xml file + ``d{model_name}.streams.xml``, where ``model_name`` can be ``atm``, + ``ice``, ``lnd``, ``ocn``, ``rof`` or ``wav``. Multiple streams can + be specified in the this xml file (see + :ref:`streams`). In turn, each stream in the xml file + can be associated with multiple stream input files. The data across + all the stream input files must all be on the same stream mesh and + share the same time coordinates. + +**stream-independent-data** + Stream-independent input is contained in the input namelist file + file ``d{model_name}_in``. This file specifies a data model mesh + file, a data model mask file along with other stream-independent + data model specific configuration variables. In addition, each + ``d{model_name}_in`` namelist file contains a namelist variable + ``datamode`` which specifies the additional operations that need to + be performed on the input streams to create the data model export + state. + +Data models leverage the CDEPS stream code to spatially interpolate the +stream data to the model resolution and temporarlly interpolate the +data to the model time. The CDEPS stream code carries this out as +follows: + +* The two timestamps of input data that bracket the present model time are read first. + These are called the lower and upper bounds of data and will change as the model advances. +* The lower and upper bound data are then spatially mapped to the + model grid based upon the in the ``d{model_name}.streams.xml`` node + ``mapalgo``. Spatial interpolation only occurs if the input data + grid and model grid are not identical, and this is determined in the + strdata module automatically. +* Time interpolation is the final step and is done using a time + interpolation method specified in the ``d{model_name}.streams.xml`` + node ``tintalgo``. +* A final set of fields is then available to the data model on the + model grid and for the current model time. +* Each data model component communicates with the NUOPC mediator and + exchanges fields on only the data model mesh. + +----------------------------------- +CDEPS and CIME Control System (CCS) +----------------------------------- + +If the CDEPS data models are used in conjunction with the CIME Case Control System (CCS) then the following will also hold: +Each data model has an xml variable in ``env_run.xml`` that specifies the data model mode. +These are: ``DATM_MODE``, ``DICE_MODE``, ``DLND_MODE``, ``DOCN_MODE``, ``DROF_MODE``, ``DWAV_MODE``. +Each data model mode specifies the streams that are associated with that data model. + +More details of the data model design are covered in :ref:`design details`. diff --git a/doc/source/streams.rst b/doc/source/streams.rst new file mode 100644 index 000000000..c2f7d9073 --- /dev/null +++ b/doc/source/streams.rst @@ -0,0 +1,398 @@ +.. _input-streams: + +Input Streams +============= + +-------- +Overview +-------- + +An *input data stream* is a time-series of input data files where all +the fields in the stream are located in the same data file and all +share the same spatial and temporal coordinates (ie. are all on the +same grid and share the same time axis). Normally a time axis has a +uniform dt, but this is not a requirement. + +The data models can have multiple input streams. + +The data for one stream may be all in one file or may be spread over +several files. For example, 50 years of monthly average data might be +contained all in one data file or it might be spread over 50 files, +each containing one year of data. + +The data models can *loop* over stream data -- i.e., repeatedly cycle +over some subset of an input stream's time axis. When looping, the +models can only loop over whole years. For example, an input stream +might have SST data for years 1950 through 2000, but a model could +loop over the data for years 1960 through 1980. A model *cannot* loop +over partial years, for example, from 1950-Feb-10 through 1980-Mar-15. + +The input data must be in a netcdf file and the time axis in that file +must be CF-1.0 compliant. + +There are two main categories of information that the data models need +to know about a stream: + +- data that describes what a user wants -- what streams to use and how + to use them -- things that can be changed by a user. + +- data that describes the stream data -- meta-data about the inherent + properties of the data itself -- things that cannot be changed by a + user. + +Generally, information about what streams a user wants to use and how +to use them is input via the strdata ("stream data") Fortran namelist, +while meta-data that describes the stream data itself is found in an +xml-like text file called a "stream description file." + +.. _stream_description_file: + +-------------------------------------------------- +Data Model Stream XML Input +-------------------------------------------------- + +The data models advance in time discretely. At a given time, the +stream code is called to advance the data model by readind in fields +from input files. Those input files have data on a discrete time axis +as well. Each data point in the input files is associated with a +discrete time (as opposed to a time interval). Depending on whether +you pick lower, upper, nearest, linear, or coszen, the data in the +input file will be "interpolated" to the time in the model. + +Stream-dependent input is contained in an input xml file +``d{model_name}.streams.xml``, where ``model_name`` can be ``atm``, +``ice``, ``lnd``, ``ocn``, ``rof`` or ``wav``. Multiple streams can +be specified in the this xml file (see :ref:`streams`). + +The schema for this xml file is as follows:: + + + + + + + + + + + + + + + + + + + + + + + +where: + +**taxMode** + How to handle data outside the specified stream time axis. + Valid options are to cycle the data based on the first, last, and align + settings associated with the stream dataset, to extend the first and last + valid value indefinitely, or to limit the interpolated data to fall only between + the least and greatest valid value of the time array. Valid values are: + + extend = extrapolate before and after the period by using the first or last value. + + cycle = cycle between the range of data + + limit = restrict to the period for which the data is valid + + CIME-CCS default = cycle + +**tInterpAlgo** + time interpolation algorithm option. Valid values are: + + lower = Use lower time-value + + upper = Use upper time-value + + nearest = Use the nearest time-value + + linear = Linearly interpolate between the two time-values + + coszen = Scale according to the cosine of the solar zenith angle (for solar) + + CIME-CCS default = linear + +**dtlimit** + Specifies delta time ratio limits placed on the time interpolation + associated with the array of streams. Causes the model to stop if + the ratio of the running maximum delta time divided by the minimum delta time + is greater than the dtlimit for that stream. + + For instance, with daily data, the delta time should be exactly one + day throughout the dataset and the computed maximum divided by + minimum delta time should always be 1.0. For monthly data, the + delta time should be between 28 and 31 days and the maximum ratio + should be about 1.1. The running value of the delta time is + computed as data is read and any wraparound or cycling is also + included. this input helps trap missing data or errors in cycling. + to turn off trapping, set the value to 1.0e30 or something similar. + + CIME-CCS default=1.5 + +**stream_mapalgo** + spatial interpolation algorithms to map stream data on stream mesh + to stream data on model mesh. Valid values are: + + redist, bilinear consf + +**stream_vectors** + paired vector field names + +**stream_data_files** + Each entry contains a data files to use. If there is + more than one file, the files must be in chronological order, that + is, the dates in time axis of the first file are before the dates + in the time axis of the second file. + +**stream_data_variables** + Each entry contains a paired list with the name of the + variable in the netCDF file on the left and the name of the + corresponding model variable on the right. + +**stream_offset** + The offset allows a user to shift the time axis of a data stream by + a fixed and constant number of seconds. For instance, if a data set + contains daily average data with timestamps for the data at the end + of the day, it might be appropriate to shift the time axis by 12 + hours so the data is taken to be at the middle of the day instead of + the end of the day. This feature supports only simple shifts in + seconds as a way of correcting input data time axes without having + to modify the input data time axis manually. This feature does not + support more complex shifts such as end of month to mid-month. But + in conjunction with the time interpolation methods in the strdata + input, hopefully most user needs can be accommodated with the two + settings. Note that a positive offset advances the input data time + axis forward by that number of seconds. + + As an example of offsets, if the input data is at 0, 3600, 7200, + 10800 seconds (hourly) and you set an offset of 1800, then the input + data will be set at times 1800, 5400, 9000, and 12600. So a model + at time 3600 using linear interpolation would have data at "n=2" + with offset of 0 will have data at "n=(2+3)/2" with an offset + of 1800. n=2 is the 2nd data in the time list 0, 3600, 7200, 10800 + in this example. n=(2+3)/2 is the average of the 2nd and 3rd data + in the time list 0, 3600, 7200, 10800. offset can be positive or + negative. + + CIME-CCS default = 0 + +**yearFirst** + the first year of stream data that will be used + +**yearLast** + the last year of stream data that will be used + +**yearAlign** + the simulation year corresponding to ``yearFirst``. + + A common usage is to set this to the first year of the model run + (for CIME-CCS this would correspond to the xml variable + ``RUN_STARTDATE``). With this setting, the forcing in the first year + of the run will be the forcing of year ``yearFirst``. + + Another usage is to align the calendar of transient forcing with + the model calendar. For example, setting ``yearAlign`` = + ``yearFirst`` will lead to the forcing calendar being the same as + the model calendar. The forcing for a given model year would be the + forcing of the same year. This would be appropriate in transient + runs where the model calendar is setup to span the same year range + as the forcing data. + + *The following pertains to CIME-CCS details for yearAlign usage* + + For some data model modes, ``yearAlign`` can be set via an xml variable + whose name ends with ``YR_ALIGN`` (there are a few such xml variables, + each pertaining to a particular data model mode). + + An example of this is land-only historical simulations in which we run + the model for 1850 to 2010 using atmospheric forcing data that is only + available for 1901 to 2010. In this case, we want to run the model for + years 1850 (so ``RUN_STARTDATE`` has year 1850) through 1900 by looping + over the forcing data for 1901-1920, and then run the model for years + 1901-2010 using the forcing data from 1901-2010. To do this, initially set:: + + ./xmlchange DATM_CLMNCEP_YR_ALIGN=1901 + ./xmlchange DATM_CLMNCEP_YR_START=1901 + ./xmlchange DATM_CLMNCEP_YR_END=1920 + + When the model has completed year 1900, set:: + + ./xmlchange DATM_CLMNCEP_YR_ALIGN=1901 + ./xmlchange DATM_CLMNCEP_YR_START=1901 + ./xmlchange DATM_CLMNCEP_YR_END=2010 + + With this setup, the correlation between model run year and forcing year + looks like this:: + + RUN Year : 1850 ... 1860 1861 ... 1870 ... 1880 1881 ... 1890 ... 1900 1901 ... 2010 + FORCE Year : 1910 ... 1920 1901 ... 1910 ... 1920 1901 ... 1910 ... 1920 1901 ... 2010 + + Setting ``DATM_CLMNCEP_YR_ALIGN`` to 1901 tells the code that you want + to align model year 1901 with forcing data year 1901, and then it + calculates what the forcing year should be if the model starts in year 1850. + +.. _input-namelists: + +-------------------------------------------------- +Data Model Namelist Input +-------------------------------------------------- + +Each data model has an associated input namelist file, ``d{model_name}_in``, +where ``model_name=[datm,dlnd,dice,docn,drof,dwav]``. + +The following namelist variables appear in each data model namelist: + +**dataMode** + component specific mode. + + Each CIME data model has its own datamode values as described below: + + :ref:`datm dataMode` + + :ref:`dice dataMode` + + :ref:`dlnd dataMode` + + :ref:`docn dataMode` + + :ref:`drof dataMode` + + :ref:`dwav dataMode` + +--------------------------------------------------- + CIME-CCS Customization of stream description files +---------------------------------------------------- + +Each data model's **cime-config/buildnml** utility automatically +generates the required stream description files for the case. The +directory contents of each data model will look like the following +(using DATM as an example) :: + + $CIMEROOT/components/data_comps/datm/cime_config/buildnml + $CIMEROOT/components/data_comps/datm/cime_config/namelist_definition_datm.xml + +The ``namelist_definition_datm.xml`` file defines and sets default +values for all the namelist variables and associated groups and also +provides out-of-the box settings for the target data model and target +stream. **buildnml** utilizes these two files to construct the stream +files for the given compset settings. You can modify the generated +stream files for your particular needs by doing the following: + +1. Copy the relevant description file from ``$CASEROOT/CaseDocs`` to + ``$CASEROOT``. Change the permission of the file to write. + +2. Edit the ``$CASEROOT`` file with your desired changes. + + - *Be sure not to put any tab characters in the file: use spaces + instead*. + +3. Call **preview_namelists** and verify that your changes do indeed + appear in the resultant stream description file appear in + ``CaseDocs/{model_name}streams.xml``. These changes will + also appear in ``$RUNDIR/{model_name}.streams.xml``. + + +-------------------------------------------------- +Data Model Stream Inline API +-------------------------------------------------- + +As mentioned previously, the streams code can be used from either a +CDEPS data model **OR** inline calls from a prognostic component. This +is a very powerful feature in that data model input can be obtained +using standardized interfaces and ESMF online mapping. + +The inline API assumes that there is **only one stream** and consists +of two calls: one to initialize the stream data type +(``shr_strdata_init``): + +.. code-block:: Fortran + + call shr_strdata_init_from_inline(sdat, my_task, logunit, compname, & + model_clock, model_mesh, & + stream_meshfile, stream_mapalgo, & + stream_filenames, stream_fldlistFile, stream_fldListModel, & + stream_yearFirst, stream_yearLast, stream_yearAlign, & + stream_offset, stream_taxmode, rc) + + type(shr_strdata_type) , intent(inout) :: sdat ! stream data type + integer , intent(in) :: my_task ! my mpi task + integer , intent(in) :: logunit ! stdout logunit + character(len=*) , intent(in) :: compname ! component name (e.g. ATM, OCN, ...) + type(ESMF_Clock) , intent(in) :: model_clock ! model clock + type(ESMF_Mesh) , intent(in) :: model_mesh ! model mesh + character(len=*) , intent(in) :: stream_meshFile ! full pathname to stream mesh file + character(len=*) , intent(in) :: stream_mapalgo ! stream mesh -> model mesh mapping type + character(len=*) , intent(in) :: stream_filenames(:) ! stream data filenames (full pathnamesa) + character(len=*) , intent(in) :: stream_fldListFile(:) ! file field names, colon delim list + character(len=*) , intent(in) :: stream_fldListModel(:) ! model field names, colon delim list + integer , intent(in) :: stream_yearFirst ! first year to use + integer , intent(in) :: stream_yearLast ! last year to use + integer , intent(in) :: stream_yearAlign ! align yearFirst with this model year + integer , intent(in) :: stream_offset ! offset in seconds of stream data + character(len=*) , intent(in) :: stream_taxMode ! time axis mode + integer , intent(out) :: rc ! error code + +and one to advance the stream (``shr_strdata_advance``): + +.. code-block:: Fortran + + subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) + + type(shr_strdata_type) ,intent(inout) :: sdat ! stream data type + integer ,intent(in) :: ymd ! current model date + integer ,intent(in) :: tod ! current model date + integer ,intent(in) :: logunit ! stdout logunit + character(len=*) ,intent(in) :: istr ! string used for timing output + integer ,intent(out) :: rc ! error code + +-------------------------------------------------- +Handling Stream Calendars +-------------------------------------------------- + +Handling stream calendars can be tricky if there are mismatches +between the stream and data model calendars. CDEPS always uses the +stream calendar for time interpolation for reasons described below. +When there is a calendar mismatch, Feb 29 is supported in a special +way as needed to get reasonable values. Note that when Feb 29 needs +to be treated specially, a discontinuity will be introduced. The size +of that discontinuity will depend on the time series input data. +Four cases can occur: + +1. The stream calendar and model calendar are identical + Proceed in the standard way. + +2. The stream is a no leap calendar and the model is gregorian calendar. + Time interpolate on the noleap calendar. If the model date is Feb 29, + compute stream data for Feb 28 by setting model time to Feb 28. + This results in duplicate stream data on Feb 28 and Feb 29 and a + discontinuity at the start of Feb 29. This could potentially be fixed + by using the gregorian calendar for time interpolation when the input data + is relatively infrequent (say greater than daily) with the following concerns. + + - The forcing will not be reproduced identically on the same day with + with climatological inputs data + + - Input data with variable input frequency might behave funny + + - An arbitrary discontinuity will be introduced in the time + interpolation method based upon the logic chosen to transition + from reproducing Feb 28 on Feb 29 and interpolating to Feb 29. + + - The time gradient of data will change by adding a day arbitrarily. + +3. The stream is a gregorian calendar and the model is a noleap calendar + Time interpolate on the gregorian calendar. This causes Feb 29 + stream data to be skipped and lead to a discontinuity at the start + of March 1. + +4. The calendars mismatch and none of the above + If the calendars mismatch and neither of the three cases above are + recognized, then abort. diff --git a/docn/CMakeLists.txt b/docn/CMakeLists.txt index 1253fd1d4..33e3ba01c 100644 --- a/docn/CMakeLists.txt +++ b/docn/CMakeLists.txt @@ -21,4 +21,4 @@ target_include_directories (docn PUBLIC "${CMAKE_BINARY_DIR}/dshr") target_include_directories (docn PUBLIC "${CMAKE_SOURCE_DIR}") target_include_directories (docn PUBLIC "${CMAKE_BINARY_DIR}/share") target_include_directories (docn PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (docn PUBLIC "${PIO_INCDIR}") +target_include_directories (docn PUBLIC "${PIO_Fortran_INCLUDE_DIR}") diff --git a/docn/cime_config/buildnml b/docn/cime_config/buildnml index c1798d8c0..aeb97f895 100755 --- a/docn/cime_config/buildnml +++ b/docn/cime_config/buildnml @@ -1,6 +1,6 @@ #!/usr/bin/env python -"""Namelist creator for CIME's data ocn model. +"""Namelist creator for CDEPS data ocn model. """ # Typically ignore this. @@ -11,8 +11,13 @@ import os, sys, re -_CIMEROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..","..","..","..","..") -sys.path.append(os.path.join(_CIMEROOT, "scripts", "Tools")) +_CDEPS_CONFIG = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,os.pardir,"cime_config") +_CIMEROOT = os.environ.get("CIMEROOT") +if _CIMEROOT is None: + raise SystemExit("ERROR: must set CIMEROOT environment variable") +_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") +sys.path.append(_LIBDIR) +sys.path.append(_CDEPS_CONFIG) from standard_script_setup import * from CIME.case import Case @@ -20,6 +25,7 @@ from CIME.XML.files import Files from CIME.nmlgen import NamelistGenerator from CIME.utils import expect, safe_copy from CIME.buildnml import create_namelist_infile, parse_input, copy_inputs_to_rundir +from stream_cdeps import StreamCDEPS logger = logging.getLogger(__name__) @@ -34,21 +40,18 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path different instances. The `confdir` argument is used to specify the directory in which output files will be placed. """ - #---------------------------------------------------- - # Write out docn_in and docn.streamss.xml + # Write out docn_in and docn.streams.xml #---------------------------------------------------- caseroot = case.get_value("CASEROOT") docn_mode = case.get_value("DOCN_MODE") - ocn_domain_file = case.get_value("OCN_DOMAIN_FILE") - ocn_domain_path = case.get_value("OCN_DOMAIN_PATH") ocn_grid = case.get_value("OCN_GRID") ocn_nx = case.get_value("OCN_NX") ocn_ny = case.get_value("OCN_NY") atm_nx = case.get_value("ATM_NX") atm_ny = case.get_value("ATM_NY") - grid = case.get_value("GRID") + model_grid = case.get_value("GRID") # Check for incompatible options. expect(ocn_grid != "null", @@ -60,7 +63,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path # Initialize namelist defaults config = {} - config['grid'] = grid + config['model_grid'] = model_grid config['ocn_grid'] = ocn_grid config['docn_mode'] = docn_mode config['create_mesh'] = 'true' if case.get_value("OCN_DOMAIN_MESH") == 'create_mesh' else 'false' @@ -79,12 +82,16 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path generate_stream_file = False else: generate_stream_file = True + #endif if generate_stream_file: - # Create stream xml file - docn.streams.xml - # first construct the list of streams - this uses the "streamlist" namelist_definition_docn.xml values - streams = nmlgen.get_streams() - stream_path = os.path.join(confdir, "docn.streams"+inst_string+".xml" ) - nmlgen.create_nuopc_stream_files(config, caseroot, streams, stream_path, data_list_path) + streamlist = nmlgen.get_streams() + print "DEBUG: streamlist is ",streamlist + stream_file = os.path.join(_CDEPS_CONFIG,os.pardir, "docn","cime_config","stream_definition_docn.xml") + schema_file = os.path.join(_CDEPS_CONFIG,"streams_v2.0.xsd") + streams = StreamCDEPS(stream_file, schema_file) + outfile = os.path.join(confdir, "docn.streams"+inst_string+".xml" ) + streams.create_stream_xml(streamlist, case, outfile, data_list_path) + #endif ############################################################################### def buildnml(case, caseroot, compname): diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index 345ade59e..77ce5ad2d 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -4,23 +4,36 @@ - - Replace any instance of the following substring indicators with the appropriate values: - %y = year from the range yearfirst to yearlast - %ym = year-month from the range yearfirst to yearlast with all 12 months - %ymd = year-month-day from the range yearfirst to yearlast with all 12 months - --> - - - - + + char(100) + streams + streams_file + + List of streams that docn supports. + The following are supported: prescribed, aquapfile, som, som_aquqp, interannual, and blank. + The streamslist + + + prescribed + interannual + som + som_aquap + aquapfile + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + + char @@ -96,310 +109,6 @@ - - - - - - char(100) - streams - streams_file - - List of streams that docn supports. - The following are supported: prescribed, aquapfile, som, som_aquqp, interannual, and blank. - The streamslist - - - prescribed - interannual - som - som_aquap - aquapfile - '' - '' - '' - '' - '' - '' - '' - '' - '' - '' - '' - - - - - char - streams - streams_file - Stream mesh files - - - $DIN_LOC_ROOT/share/meshes/T31_040122_ESMFmesh.nc - - - $DIN_LOC_ROOT/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc - - - $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc - - - $DIN_LOC_ROOT/share/meshes/fv0.47x0.63_141008_ESMFmesh.nc - - - - - - $DIN_LOC_ROOT/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc - - - $DIN_LOC_ROOT/atm/cam/sst/sst_HadOIBl_bc_1x1_clim_c101029_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/ocn/docn7/SOM/pop_frc.1x1d.SCRIP.030620_ESMFmesh.nc - - - $DIN_LOC_ROOT/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc - - - $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc - - - $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc - - - - - - char - streams - derived - does not appear in namelist - only used to set domain and data information - - - $SSTICE_DATA_FILENAME - - - $DIN_LOC_ROOT/ocn/docn7/SOM/pop_frc.1x1d.090130.nc - - - $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.2degFV_c20170421.nc - - - $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.1degFV_c20170421.nc - - - sst_c4aquasom_0.9x1.25_clim.c170512.nc - - - - - - char - streams - streams_file - Stream data variable name(s). - - - T So_t - S So_s - U So_u - V So_v - dhdx So_dhdx - dhdy So_dhdy - hblt So_h - qdp So_qbot - - - T So_t - S So_s - U So_u - V So_v - dhdx So_dhdx - dhdy So_dhdy - hblt So_h - qdp So_qbot - - - SST_cpl So_t - - - SST_cpl So_t - - - SST_cpl So_t - - - - - - integer - streams - streams_file - Stream offset. - - 0 - - - - - integer - streams - streams_file - Simulation year to align stream to. - - -999 - $SSTICE_YEAR_ALIGN - 0 - 1 - 1 - - - - - integer - streams - streams_file - First year of stream. - - -999 - $SSTICE_YEAR_START - 0 - 1 - 1850 - - - - - integer - streams - streams_file - Last year of stream. - - -999 - $SSTICE_YEAR_END - 0 - 1 - 2014 - - - - - char(30) - streams - streams_file - bilinear,nn - - type of mapping from stream mesh -> model mesh - - - bilinear - - - - - char(30) - streams - streams_file - coszen,nearest,linear,lower,upper - - time interpolation options of stream time to model time - valid values: lower,upper,nearest,linear,coszen - lower = Use lower time-value - upper = Use upper time-value - nearest = Use the nearest time-value - linear = Linearly interpolate between the two time-values - coszen = Scale according to the cosine of the solar zenith angle (for solar) - - - linear - - - - - char(30) - streams - streams_file - extend,cycle,limit - - specifies how to handle data outside the specified stream time - axis. valid options are to cycle the data based on the first, - last, and align settings associated with the stream dataset, to - extend the first and last valid value indefinitely, or to limit - the interpolated data to fall only between the least and - greatest valid value of the time array. - valid values: cycle,extend,limit - ==> extend = extrapolate before and after the period by using the first or last value. - ==> cycle = cycle between the range of data - ==> limit = restrict to the period for which the data is valid - - - cycle - - - - - char(30) - streams - streams_file - single,full_file - - mode of reading temporal stream dataset. valid options are - "single" (read temporal dataset one at a time) or "full_file" - (read all entires of temporal dataset in a given netcdf file) - valid values: single,full_file - - - single - - - - - real(30) - streams - streams_file - - delta time ratio limits placed on the time interpolation associated - with the array of streams. this real - value causes the model to stop if the ratio of the running maximum - delta time divided by the minimum delta time is greater than the - dtlimit for that stream. for instance, with daily data, the delta - time should be exactly one day throughout the dataset and the computed - maximum divided by minimum delta time should always be 1.0. for - monthly data, the delta time should be between 28 and 31 days and the - maximum ratio should be about 1.1. the running value of the delta - time is computed as data is read and any wraparound or cycling is also - included. this input helps trap missing data or errors in cycling. - to turn off trapping, set the value to 1.0e30 or something similar. - - - 1.5e0 - - - - - char - streams - streams_file - - list of paired colon delimited field names that should be treated as - vectors when carrying out spatial interpolation. unlike other - character arrays in this namelist, this array is completely decoupled - from the list of streams. this is a list of vector pairs that span - all input streams where different fields of the vector pair could - appear in different streams. - for example, vectors = 'u:v','taux:tauy'. - - - null - - - - - - - char streams diff --git a/docn/cime_config/stream_definition_docn.xml b/docn/cime_config/stream_definition_docn.xml new file mode 100644 index 000000000..a1be32f34 --- /dev/null +++ b/docn/cime_config/stream_definition_docn.xml @@ -0,0 +1,185 @@ + + + + + + + + + $DIN_LOC_ROOT/share/meshes/T31_040122_ESMFmesh.nc + $DIN_LOC_ROOT/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + $DIN_LOC_ROOT/share/meshes/fv0.47x0.63_141008_ESMFmesh.nc + + $DIN_LOC_ROOT/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc + $DIN_LOC_ROOT/atm/cam/sst/sst_HadOIBl_bc_1x1_clim_c101029_ESMFmesh_120520.nc + + + $SSTICE_DATA_FILENAME + + + SST_cpl So_t + + null + + bilinear + + null + $SSTICE_YEAR_ALIGN + $SSTICE_YEAR_START + $SSTICE_YEAR_END + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/atm/cam/sst/sst_HadOIBl_bc_1x1_clim_c101029_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/atm/cam/sst/sst_HadOIBl_bc_1x1_1850_2014_c150416.nc + + + SST_cpl So_t + + null + + bilinear + + null + 1 + 1850 + 2014 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/ocn/docn7/SOM/pop_frc.1x1d.SCRIP.030620_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/docn7/SOM/pop_frc.1x1d.090130.nc + + + T So_t + S So_s + U So_u + V So_v + dhdx So_dhdx + dhdy So_dhdy + hblt So_h + qdp So_qbot + + null + + bilinear + + null + 1 + 1 + 1 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + $DIN_LOC_ROOT/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.2degFV_c20170421.nc + $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.1degFV_c20170421.nc + + + T So_t + S So_s + U So_u + V So_v + dhdx So_dhdx + dhdy So_dhdy + hblt So_h + qdp So_qbot + + null + + bilinear + + null + 1 + 1 + 1 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + %DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc + + + sst_c4aquasom_0.9x1.25_clim.c170512.nc + + + SST_cpl So_t + + null + + bilinear + + null + 0 + 0 + 0 + 0 + + linear + + + cycle + + + 1.5 + + single + + + diff --git a/docn/docn_datamode_aquaplanet_mod.F90 b/docn/docn_datamode_aquaplanet_mod.F90 index fc004f6a1..e687d8d85 100644 --- a/docn/docn_datamode_aquaplanet_mod.F90 +++ b/docn/docn_datamode_aquaplanet_mod.F90 @@ -92,7 +92,6 @@ subroutine docn_datamode_aquaplanet_init_pointers(exportState, ocn_fraction, rc) integer , intent(out) :: rc ! local variables - type(ESMF_StateItem_Flag) :: itemFlag character(len=*), parameter :: subname='(docn_init_pointers): ' !------------------------------------------------------------------------------- diff --git a/docn/docn_datamode_copyall_mod.F90 b/docn/docn_datamode_copyall_mod.F90 index 103e8aed6..08fb4600f 100644 --- a/docn/docn_datamode_copyall_mod.F90 +++ b/docn/docn_datamode_copyall_mod.F90 @@ -124,7 +124,7 @@ end subroutine docn_datamode_copyall_advance !=============================================================================== subroutine docn_datamode_copyall_restart_write(case_name, inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) ! input/output variables character(len=*) , intent(in) :: case_name @@ -133,12 +133,11 @@ subroutine docn_datamode_copyall_restart_write(case_name, inst_suffix, ymd, tod, integer , intent(in) :: tod ! model sec into model date integer , intent(in) :: logunit integer , intent(in) :: my_task - integer , intent(in) :: mpicom type(shr_strdata_type) , intent(inout) :: sdat !------------------------------------------------------------------------------- call dshr_restart_write(rpfile, case_name, 'docn', inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) end subroutine docn_datamode_copyall_restart_write diff --git a/docn/docn_datamode_iaf_mod.F90 b/docn/docn_datamode_iaf_mod.F90 index 4edc514aa..6edc5e087 100644 --- a/docn/docn_datamode_iaf_mod.F90 +++ b/docn/docn_datamode_iaf_mod.F90 @@ -178,7 +178,7 @@ end subroutine docn_datamode_iaf_advance !=============================================================================== subroutine docn_datamode_iaf_restart_write(case_name, inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) ! write restart file @@ -189,12 +189,11 @@ subroutine docn_datamode_iaf_restart_write(case_name, inst_suffix, ymd, tod, & integer , intent(in) :: tod ! model sec into model date integer , intent(in) :: logunit integer , intent(in) :: my_task - integer , intent(in) :: mpicom type(shr_strdata_type) , intent(inout) :: sdat !------------------------------------------------------------------------------- call dshr_restart_write(rpfile, case_name, 'docn', inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) end subroutine docn_datamode_iaf_restart_write diff --git a/docn/docn_datamode_som_mod.F90 b/docn/docn_datamode_som_mod.F90 index 2d3f7a2a2..c73a4434d 100644 --- a/docn/docn_datamode_som_mod.F90 +++ b/docn/docn_datamode_som_mod.F90 @@ -298,7 +298,7 @@ end subroutine docn_datamode_som_advance !=============================================================================== subroutine docn_datamode_som_restart_write(case_name, inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) ! write restart file @@ -309,12 +309,11 @@ subroutine docn_datamode_som_restart_write(case_name, inst_suffix, ymd, tod, & integer , intent(in) :: tod ! model sec into model date integer , intent(in) :: logunit integer , intent(in) :: my_task - integer , intent(in) :: mpicom type(shr_strdata_type) , intent(inout) :: sdat !------------------------------------------------------------------------------- call dshr_restart_write(rpfile, case_name, 'docn', inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat, fld=somtp, fldname='somtp') + logunit, my_task, sdat, fld=somtp, fldname='somtp') end subroutine docn_datamode_som_restart_write diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 1236b056d..60ba6ba1a 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -22,8 +22,6 @@ module ocn_comp_nuopc use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_realize - use perf_mod , only : t_startf, t_stopf, t_adj_detailf, t_barrierf - use pio ! Datamode specialized modules use docn_datamode_copyall_mod , only : docn_datamode_copyall_advertise @@ -169,8 +167,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer :: nu ! unit number integer :: ierr ! error code logical :: exists ! check for file existence - integer :: n - type(fldlist_type), pointer :: fldList character(len=*),parameter :: subname=trim(module_name)//':(InitializeAdvertise) ' character(*) ,parameter :: F00 = "('(ocn_comp_nuopc) ',8a)" character(*) ,parameter :: F01 = "('(ocn_comp_nuopc) ',a,2x,i8)" @@ -307,24 +303,19 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - type(ESMF_TimeInterval) :: TimeStep type(ESMF_Time) :: currTime integer :: current_ymd ! model date integer :: current_year ! model year integer :: current_mon ! model month integer :: current_day ! model day integer :: current_tod ! model sec into model date - integer :: fieldcount - type(ESMF_Field) :: lfield - character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) - integer :: n character(len=*), parameter :: subname=trim(module_name)//':(InitializeRealize) ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS ! Initialize model mesh, restart flag, logunit, model_mask and model_frac - call t_startf('docn_strdata_init') + call ESMF_TraceRegionEnter('docn_strdata_init') call dshr_mesh_init(gcomp, nullstr, logunit, 'OCN', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) @@ -336,7 +327,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'OCN', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - call t_stopf('docn_strdata_init') + call ESMF_TraceRegionExit('docn_strdata_init') ! Realize the actively coupled fields, now that a mesh is established and ! NUOPC_Realize "realizes" a previously advertised field in the importState and exportState @@ -447,7 +438,7 @@ subroutine docn_comp_run(importState, exportState, clock, target_ymd, target_tod rc = ESMF_SUCCESS - call t_startf('DOCN_RUN') + call ESMF_TraceRegionEnter('DOCN_RUN') !-------------------- ! First time initialization @@ -496,21 +487,19 @@ subroutine docn_comp_run(importState, exportState, clock, target_ymd, target_tod !-------------------- ! Advance data model streams - time and spatially interpolate to model time and grid - call t_barrierf('docn_BARRIER',mpicom) - call t_startf('docn_strdata_advance') + call ESMF_TraceRegionEnter('docn_strdata_advance') call shr_strdata_advance(sdat, target_ymd, target_tod, logunit, 'docn', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('docn_strdata_advance') + call ESMF_TraceRegionExit('docn_strdata_advance') ! Copy all fields from streams to export state as default ! This automatically will update the fields in the export state - call t_barrierf('docn_dfield_copy_BARRIER', mpicom) - call t_startf('docn_dfield_copy') + call ESMF_TraceRegionEnter('docn_dfield_copy') if(.not. aquaplanet) then call dshr_dfield_copy(dfields, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif - call t_stopf('docn_dfield_copy') + call ESMF_TraceRegionExit('docn_dfield_copy') ! Perform data mode specific calculations select case (trim(datamode)) @@ -525,7 +514,7 @@ subroutine docn_comp_run(importState, exportState, clock, target_ymd, target_tod if (ChkErr(rc,__LINE__,u_FILE_u)) return case('sst_aquap_analytic') call docn_datamode_aquaplanet_advance(exportstate, model_mesh, sst_option=aquap_option, rc=rc) - if (chkerr(rc,__line__,u_file_u)) return + if (ChkErr(rc,__LINE__,u_file_u)) return case('sst_aquap_constant') call docn_datamode_aquaplanet_advance(exportState, model_mesh, sst_constant_value=sst_constant_value, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -536,17 +525,17 @@ subroutine docn_comp_run(importState, exportState, clock, target_ymd, target_tod select case (trim(datamode)) case('sstdata','sst_aquap_file') call docn_datamode_copyall_restart_write(case_name, inst_suffix, target_ymd, target_tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) case('iaf') call docn_datamode_iaf_restart_write(case_name, inst_suffix, target_ymd, target_tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) case('som','som_aquap') call docn_datamode_som_restart_write(case_name, inst_suffix, target_ymd, target_tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) end select end if - call t_stopf('DOCN_RUN') + call ESMF_TraceRegionExit('DOCN_RUN') ! write diagnostics if (diagnose_data) then diff --git a/drof/CMakeLists.txt b/drof/CMakeLists.txt index 41ded49c8..62a92cb83 100644 --- a/drof/CMakeLists.txt +++ b/drof/CMakeLists.txt @@ -16,4 +16,4 @@ target_include_directories (drof PUBLIC "${CMAKE_BINARY_DIR}/dshr") target_include_directories (drof PUBLIC "${CMAKE_SOURCE_DIR}") target_include_directories (drof PUBLIC "${CMAKE_BINARY_DIR}/share") target_include_directories (drof PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (drof PUBLIC "${PIO_INCDIR}") +target_include_directories (drof PUBLIC "${PIO_Fortran_INCLUDE_DIR}") diff --git a/drof/cime_config/buildnml b/drof/cime_config/buildnml index 3d6231027..316b46906 100755 --- a/drof/cime_config/buildnml +++ b/drof/cime_config/buildnml @@ -1,6 +1,6 @@ #!/usr/bin/env python -"""Namelist creator for CIME's data river model. +"""Namelist creator for CDEPS data river model. """ # Typically ignore this. @@ -11,8 +11,13 @@ import os, sys -_CIMEROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..","..","..","..","..") -sys.path.append(os.path.join(_CIMEROOT, "scripts", "Tools")) +_CDEPS_CONFIG = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,os.pardir,"cime_config") +_CIMEROOT = os.environ.get("CIMEROOT") +if _CIMEROOT is None: + raise SystemExit("ERROR: must set CIMEROOT environment variable") +_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") +sys.path.append(_LIBDIR) +sys.path.append(_CDEPS_CONFIG) from standard_script_setup import * from CIME.case import Case @@ -20,6 +25,7 @@ from CIME.XML.files import Files from CIME.nmlgen import NamelistGenerator from CIME.utils import expect, safe_copy from CIME.buildnml import create_namelist_infile, parse_input, copy_inputs_to_rundir +from stream_cdeps import StreamCDEPS logger = logging.getLogger(__name__) @@ -56,12 +62,12 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['drof_mode'] = drof_mode config['create_mesh'] = 'true' if case.get_value("ROF_DOMAIN_MESH") == 'create_mesh' else 'false' - # do not allow single column mode for drof + # Do not allow single column mode for drof scol_mode = True if case.get_value('PTS_MODE') else False expect(not scol_mode, "for, DROF single column mode is not allowed") - # initialize nmlgen + # Initialize nmlgen nmlgen.init_defaults(infile, config) # Generate drof_in @@ -69,9 +75,12 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path nmlgen.write_output_file(namelist_file, data_list_path, groups=['drof_nml']) # Generate drof.streams.xml - streams = nmlgen.get_streams() - stream_path = os.path.join(confdir, "drof.streams"+inst_string+".xml" ) - nmlgen.create_nuopc_stream_files(config, caseroot, streams, stream_path, data_list_path) + streamlist = nmlgen.get_streams() + stream_file = os.path.join(_CDEPS_CONFIG,os.pardir, "drof","cime_config","stream_definition_drof.xml") + schema_file = os.path.join(_CDEPS_CONFIG,"streams_v2.0.xsd") + streams = StreamCDEPS(stream_file, schema_file) + outfile = os.path.join(confdir, "drof.streams"+inst_string+".xml" ) + streams.create_stream_xml(streamlist, case, outfile, data_list_path) ############################################################################### def buildnml(case, caseroot, compname): diff --git a/drof/cime_config/namelist_definition_drof.xml b/drof/cime_config/namelist_definition_drof.xml index ae6e31960..be837ce15 100644 --- a/drof/cime_config/namelist_definition_drof.xml +++ b/drof/cime_config/namelist_definition_drof.xml @@ -4,48 +4,6 @@ - - - - - - - - char - drof - drof_nml - copyall - - The runoff data is associated with the river model. - Copies all fields directly from the input data streams Any required - fields not found on an input stream will be set to zero. - The only datamode is copyall - the streams are determined by the xml variable $DROF_MODE - dataMode = "copyall" - - - copyall - - - - - - - char(100) streams @@ -66,388 +24,23 @@ - - char - streams - streams_file - Stream mesh - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf_ESMFmesh_120520.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf_ESMFmesh_120520.nc - - - - - - - $ROF_DOMAIN_MESH - - - - - - char - streams - streams_file - Stream data file path(s). - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual.20190226.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual.20190226.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual.20190226.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual.20190226.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf.20120419.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf-AISx00.20120419.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf-AISx45.20120419.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf-AISx55.20120419.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual.20190226.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf.20120419.nc - - - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1958.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1959.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1960.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1961.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1962.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1963.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1964.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1965.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1966.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1967.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1968.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1969.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1970.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1971.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1972.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1973.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1974.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1975.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1976.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1977.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1978.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1979.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1980.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1981.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1982.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1983.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1984.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1985.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1986.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1987.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1988.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1989.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1990.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1991.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1992.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1993.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1994.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1995.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1996.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1997.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1998.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.1999.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2000.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2001.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2002.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2003.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2004.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2005.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2006.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2007.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2008.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2009.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2010.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2011.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2012.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2013.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2014.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2015.170807.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.2016.170807.nc - - - $DROF_CPLHIST_DIR/$DROF_CPLHIST_CASE.cpl.hr2x.%ym.nc - - - - - - char - streams - streams_file - Stream data variable name(s). - - - runoff Forr_rofl - - - runoff Forr_rofl - - - runoff Forr_rofl - - - runoff Forr_rofl - - - runoff Forr_rofl - - - runoff Forr_rofl - - - runoff Forr_rofl - - - runoff Forr_rofl - - - runoff Forr_rofl - - - runoff Forr_rofl - - - rofl Forr_rofl - rofi Forr_rofi - - - rofImp_Forr_rofl Forr_rofl - rofImp_Forr_rofi Forr_rofi - - - - - - integer - streams - streams_file - Stream offset. - - 0 - 0 - - - - - integer - streams - streams_file - Simulation year to align stream to. - - 1 - $DROF_CPLHIST_YR_ALIGN - - - - - integer - streams - streams_file - First year of stream. - - 1 - 1 - 1 - 1 - 1948 - 1948 - 1948 - 1948 - 1958 - $DROF_CPLHIST_YR_START - - - - - integer - streams - streams_file - Last year of stream. - - 1 - 1 - 1 - 1 - 2009 - 2009 - 2009 - 2009 - 2018 - 2016 - $DROF_CPLHIST_YR_END - - - - - char(30) - streams - streams_file - bilinear,nn - - array (up to 30 elements) of fill algorithms associated with the array of streams. - default value: bilinear - valid values: bilinear, nn - - - bilinear - - - - - char(30) - streams - streams_file - coszen,nearest,linear,lower,upper - - array (up to 30 elements) of time interpolation options associated with the array of streams. - valid values: lower,upper,nearest,linear,coszen - lower = Use lower time-value - upper = Use upper time-value - nearest = Use the nearest time-value - linear = Linearly interpolate between the two time-values - coszen = Scale according to the cosine of the solar zenith angle (for solar) - - - linear - upper - upper - upper - nearest - - - - - char(30) - streams - streams_file - extend,cycle,limit - - array of time axis modes associated with the array of streams for - handling data outside the specified stream time axis. - valid options are to cycle the data based on the first, last, and - align settings associated with the stream dataset, to extend the first - and last valid value indefinitely, or to limit the interpolated data - to fall only between the least and greatest valid value of the time array. - valid values: cycle,extend,limit - extend = extrapolate before and after the period by using the first or last value. - cycle = cycle between the range of data - limit = restrict to the period for which the data is valid - - - cycle - - - - - char(30) - streams - streams_file - single,full_file - - array (up to 30 elements) of reading mode associated with the array of streams. - specifies the mode of reading temporal stream dataset. - valid options are "single" (read temporal dataset one at a time) or - "full_file" (read all entires of temporal dataset in a given netcdf file) - valid values: single,full_file - - - single - - - - - real(30) - streams - streams_file - - array (up to 30 elements) of delta time ratio limits placed on the - time interpolation associated with the array of streams. this real - value causes the model to stop if the ratio of the running maximum - delta time divided by the minimum delta time is greater than the - dtlimit for that stream. for instance, with daily data, the delta - time should be exactly one day throughout the dataset and the computed - maximum divided by minimum delta time should always be 1.0. for - monthly data, the delta time should be between 28 and 31 days and the - maximum ratio should be about 1.1. the running value of the delta - time is computed as data is read and any wraparound or cycling is also - included. this input helps trap missing data or errors in cycling. - to turn off trapping, set the value to 1.0e30 or something similar. - - - 3.0 - - - - + char - streams - streams_file + drof + drof_nml + copyall - list of paired colon delimited field names that should be treated as - vectors when carrying out spatial interpolation. unlike other - character arrays in this namelist, this array is completely decoupled - from the list of streams. this is a list of vector pairs that span - all input streams where different fields of the vector pair could - appear in different streams. - for example, vectors = 'u:v','taux:tauy'. + The runoff data is associated with the river model. + Copies all fields directly from the input data streams Any required + fields not found on an input stream will be set to zero. + The only datamode is copyall - the streams are determined by the xml variable $DROF_MODE + dataMode = "copyall" - null + copyall - - - - char streams diff --git a/drof/cime_config/stream_definition_drof.xml b/drof/cime_config/stream_definition_drof.xml new file mode 100644 index 000000000..2a3efef97 --- /dev/null +++ b/drof/cime_config/stream_definition_drof.xml @@ -0,0 +1,382 @@ + + + + + + + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual.20190226.nc + + + runoff Forr_rofl + + null + + bilinear + + null + 1 + 1 + 1 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual.20190226.nc + + + runoff Forr_rofl + + null + + bilinear + + null + 1 + 1 + 1 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual.20190226.nc + + + runoff Forr_rofl + + null + + bilinear + + null + 1 + 1 + 1 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual.20190226.nc + + + runoff Forr_rofl + + null + + bilinear + + null + 1 + 1 + 1 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual.20190226.nc + + + runoff Forr_rofl + + null + + bilinear + + null + 1 + 1 + 1 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf.20120419.nc + + + runoff Forr_rofl + + null + + bilinear + + null + 1 + 1948 + 2009 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf-AISx00.20120419.nc + + + runoff Forr_rofl + + null + + bilinear + + null + 1 + 1948 + 2009 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf-AISx45.20120419.nc + + + runoff Forr_rofl + + null + + bilinear + + null + 1 + 1948 + 2009 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.annual_ESMFmesh_120520.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf-AISx55.20120419.nc + + + runoff Forr_rofl + + null + + bilinear + + null + 1 + 1948 + 2009 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.%y.170807.nc + + + rofl Forr_rofl + rofi Forr_rofi + + null + + bilinear + + null + 1 + 1958 + 2016 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.%y.170807.nc + + + rofl Forr_rofl + rofi Forr_rofi + + null + + bilinear + + null + 1 + 1958 + 2018 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $ROF_DOMAIN_MESH + + + $DIN_LOC_ROOT/lnd/dlnd7/RX1/runoff.daitren.iaf.20120419.nc + + + rofImp_Forr_rofl Forr_rofl + rofImp_Forr_rofi Forr_rofi + + null + + bilinear + + null + $DROF_CPLHIST_YR_ALIGN + $DROF_CPLHIST_YR_START + $DROF_CPLHIST_YR_END + 0 + + nearest + + + cycle + + + 3.0 + + single + + + diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index e4963cd7f..529409cc8 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -25,7 +25,6 @@ module rof_comp_nuopc use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize - use perf_mod , only : t_startf, t_stopf, t_adj_detailf, t_barrierf implicit none private ! except @@ -72,7 +71,6 @@ module rof_comp_nuopc character(*) , parameter :: modName = "(rof_comp_nuopc)" ! linked lists - type(fldList_type) , pointer :: fldsImport => null() type(fldList_type) , pointer :: fldsExport => null() type(dfield_type) , pointer :: dfields => null() @@ -147,7 +145,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! local variables integer :: inst_index ! number of current instance (ie. 1) - character(len=CL) :: cvalue ! temporary integer :: nu ! unit number integer :: ierr ! error code logical :: exists ! check for file existence @@ -268,8 +265,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: current_mon ! model month integer :: current_day ! model day integer :: current_tod ! model sec into model date - character(CL) :: cvalue ! temporary - integer :: n,k ! generic counters character(len=*), parameter :: F00 = "('rof_comp_nuopc: ')',8a)" character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -277,7 +272,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) rc = ESMF_SUCCESS ! Initialize mesh, restart flag, logunit - call t_startf('drof_strdata_init') + call ESMF_TraceRegionEnter('drof_strdata_init') call dshr_mesh_init(gcomp, nullstr, logunit, 'ROF', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) @@ -287,7 +282,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) xmlfilename = 'drof.streams'//trim(inst_suffix)//'.xml' call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'ROF', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('drof_strdata_init') + call ESMF_TraceRegionExit('drof_strdata_init') ! NUOPC_Realize "realizes" a previously advertised field in the importState and exportState ! by replacing the advertised fields with the newly created fields of the same name. @@ -392,7 +387,7 @@ subroutine drof_comp_run(exportState, target_ymd, target_tod, restart_write, rc) character(*), parameter :: subName = "(drof_comp_run) " !------------------------------------------------------------------------------- - call t_startf('DROF_RUN') + call ESMF_TraceRegionEnter('DROF_RUN') !-------------------- ! First time initialization @@ -424,21 +419,19 @@ subroutine drof_comp_run(exportState, target_ymd, target_tod, restart_write, rc) !-------------------- ! time and spatially interpolate to model time and grid - call t_barrierf('drof_BARRIER',mpicom) - call t_startf('drof_strdata_advance') + call ESMF_TraceRegionEnter('drof_strdata_advance') call shr_strdata_advance(sdat, target_ymd, target_tod, logunit, 'drof', rc=rc) - call t_stopf('drof_strdata_advance') + call ESMF_TraceRegionExit('drof_strdata_advance') ! copy all fields from streams to export state as default ! This automatically will update the fields in the export state - call t_barrierf('drof_comp_dfield_copy_BARRIER', mpicom) - call t_startf('drof_dfield_copy') + call ESMF_TraceRegionEnter('drof_dfield_copy') call dshr_dfield_copy(dfields, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('drof_dfield_copy') + call ESMF_TraceRegionExit('drof_dfield_copy') ! determine data model behavior based on the mode - call t_startf('drof_datamode') + call ESMF_TraceRegionEnter('drof_datamode') select case (trim(datamode)) case('copyall') ! zero out "special values" of export fields @@ -453,7 +446,7 @@ subroutine drof_comp_run(exportState, target_ymd, target_tod, restart_write, rc) select case (trim(datamode)) case('copyall') call dshr_restart_write(rpfile, case_name, 'drof', inst_suffix, target_ymd, target_tod, & - logunit, mpicom, my_task, sdat) + logunit, my_task, sdat) end select end if @@ -463,8 +456,8 @@ subroutine drof_comp_run(exportState, target_ymd, target_tod, restart_write, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - call t_stopf('drof_datamode') - call t_stopf('DROF_RUN') + call ESMF_TraceRegionExit('drof_datamode') + call ESMF_TraceRegionExit('DROF_RUN') end subroutine drof_comp_run diff --git a/dshr/CMakeLists.txt b/dshr/CMakeLists.txt index f45a646bb..bf4f02553 100644 --- a/dshr/CMakeLists.txt +++ b/dshr/CMakeLists.txt @@ -2,7 +2,9 @@ project(dshr Fortran) set(SRCFILES dshr_dfield_mod.F90 dshr_fldlist_mod.F90 dshr_mod.F90) +set(MODFILES ${SRCFILES}) foreach(FILE ${SRCFILES}) + list(TRANSFORM MODFILES REPLACE ".F90" ".mod") if(EXISTS "${CASEROOT}/SourceMods/src.cdeps/${FILE}") list(REMOVE_ITEM SRCFILES ${FILE}) list(APPEND SRCFILES "${CASEROOT}/SourceMods/src.cdeps/${FILE}") @@ -19,6 +21,9 @@ add_dependencies(dshr streams) target_include_directories (dshr PUBLIC ${ESMF_F90COMPILEPATHS}) target_include_directories (dshr PUBLIC "${CMAKE_BINARY_DIR}/streams") target_include_directories (dshr PUBLIC "${CMAKE_BINARY_DIR}/share") -target_include_directories (dshr PUBLIC "${PIO_INCDIR}") +target_include_directories (dshr PUBLIC "${PIO_Fortran_INCLUDE_DIR}") install(TARGETS dshr LIBRARY DESTINATION lib) +foreach(MOD ${MODFILES}) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${MOD}" DESTINATION include) +endforeach() diff --git a/dshr/dshr_dfield_mod.F90 b/dshr/dshr_dfield_mod.F90 index 8f4a774e8..54bf02147 100644 --- a/dshr/dshr_dfield_mod.F90 +++ b/dshr/dshr_dfield_mod.F90 @@ -65,7 +65,6 @@ subroutine dshr_dfield_add_1d(dfields, sdat, state_fld, strm_fld, state, logunit integer :: status character(cl) :: msgstr integer :: fieldcount - type(ESMF_Field) :: lfield type(ESMF_FieldBundle) :: fldbun_model character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) logical :: found @@ -120,15 +119,6 @@ subroutine dshr_dfield_add_1d(dfields, sdat, state_fld, strm_fld, state, logunit 110 format(a) end if - ! write output - if (masterproc) then - if (found) then - write(logunit,100)'(dshr_addfield_add) set pointer to stream field strm_'//trim(strm_fld)//& - ' stream index = ',ns,' field bundle index= ',nf -100 format(a,i6,2x,a,i6) - end if - end if - end subroutine dshr_dfield_add_1d !=============================================================================== @@ -152,7 +142,6 @@ subroutine dshr_dfield_add_1d_stateptr(dfields, sdat, state_fld, strm_fld, state integer :: status character(cl) :: msgstr integer :: fieldcount - type(ESMF_Field) :: lfield type(ESMF_FieldBundle) :: fldbun_model character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) logical :: found @@ -239,8 +228,8 @@ subroutine dshr_dfield_add_2d(dfields, sdat, state_fld, strm_flds, state, & ! local variables type(dfield_type), pointer :: dfield_new type(ESMF_FieldBundle) :: fldbun_model - integer :: n, i, ns, nf - integer :: nflds, lsize, num + integer :: n, ns, nf + integer :: nflds integer :: status character(cl) :: msgstr integer :: fieldcount @@ -343,8 +332,8 @@ subroutine dshr_dfield_add_2d_stateptr(dfields, sdat, state_fld, strm_flds, stat ! local variables type(dfield_type), pointer :: dfield_new type(ESMF_FieldBundle) :: fldbun_model - integer :: n, i, ns, nf - integer :: nflds, lsize, num + integer :: n, ns, nf + integer :: nflds integer :: status character(cl) :: msgstr integer :: fieldcount @@ -447,7 +436,7 @@ subroutine dshr_dfield_copy(dfields, sdat, rc) type(ESMF_field) :: lfield type(dfield_type), pointer :: dfield real(r8), pointer :: data1d(:) - integer :: n, nf + integer :: nf integer :: fldbun_index integer :: stream_index !------------------------------------------------------------------------------- diff --git a/dshr/dshr_fldlist_mod.F90 b/dshr/dshr_fldlist_mod.F90 index a20f6cf6c..0edab9cee 100644 --- a/dshr/dshr_fldlist_mod.F90 +++ b/dshr/dshr_fldlist_mod.F90 @@ -34,7 +34,6 @@ subroutine dshr_fldlist_add(fldlists, fldname, ungridded_lbound, ungridded_uboun integer, optional , intent(in) :: ungridded_ubound ! local variables type(fldlist_type), pointer :: fldlist_new - integer :: rc ! ---------------------------------------------- allocate(fldlist_new) @@ -62,7 +61,6 @@ subroutine dshr_fldlist_realize(state, fldLists, flds_scalar_name, flds_scalar_n integer , intent(inout) :: rc ! local variables - integer :: n type(fldlist_type), pointer :: fldList type(ESMF_Field) :: field character(len=CS) :: stdname diff --git a/dshr/dshr_mod.F90 b/dshr/dshr_mod.F90 index 0ccd9cf9d..4dcd96482 100644 --- a/dshr/dshr_mod.F90 +++ b/dshr/dshr_mod.F90 @@ -40,7 +40,6 @@ module dshr_mod use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_xml, SHR_STRDATA_GET_STREAM_COUNT use dshr_methods_mod , only : chkerr - use perf_mod , only : t_startf, t_stopf use pio implicit none @@ -225,12 +224,9 @@ subroutine dshr_mesh_init(gcomp, nullstr, logunit, compname, model_nxg, model_ny ! local variables type(ESMF_VM) :: vm - type(ESMF_Mesh) :: mesh_global type(ESMF_Calendar) :: esmf_calendar ! esmf calendar - type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type type(ESMF_DistGrid) :: distGrid integer, pointer :: model_gindex(:) ! model global index spzce - character(CS) :: calendar ! calendar name integer :: mpicom integer :: my_task logical :: scol_mode @@ -821,7 +817,6 @@ subroutine dshr_alarm_init( clock, alarm, option, & type(ESMF_Time) :: CurrTime ! Current Time type(ESMF_Time) :: NextAlarm ! Next restart alarm time type(ESMF_TimeInterval) :: AlarmInterval ! Alarm interval - integer :: sec character(len=*), parameter :: & ! Clock and alarm options optNONE = "none" , & optNever = "never" , & @@ -1135,8 +1130,7 @@ subroutine dshr_time_init( Time, ymd, cal, tod, rc) ! local variables integer :: year, mon, day ! year, month, day as integers - integer :: tdate ! temporary date - integer :: date ! coded-date (yyyymmdd) + integer :: tdate integer , parameter :: SecPerDay = 86400 ! Seconds per day character(len=*), parameter :: subname='(dshr_time_init)' !------------------------------------------------------------------------------- @@ -1147,9 +1141,9 @@ subroutine dshr_time_init( Time, ymd, cal, tod, rc) call shr_sys_abort( subname//'ERROR yymmdd is a negative number or time-of-day out of bounds' ) end if - tdate = abs(date) + tdate = abs(ymd) year = int(tdate/10000) - if (date < 0) year = -year + if (ymd < 0) year = -year mon = int( mod(tdate,10000)/ 100) day = mod(tdate, 100) @@ -1234,7 +1228,7 @@ end subroutine dshr_restart_read !=============================================================================== subroutine dshr_restart_write(rpfile, case_name, model_name, inst_suffix, ymd, tod, & - logunit, mpicom, my_task, sdat, fld, fldname) + logunit, my_task, sdat, fld, fldname) ! Write restart file @@ -1249,7 +1243,6 @@ subroutine dshr_restart_write(rpfile, case_name, model_name, inst_suffix, ymd, t integer , intent(in) :: tod ! model sec into model date integer , intent(in) :: logunit integer , intent(in) :: my_task - integer , intent(in) :: mpicom type(shr_strdata_type) , intent(inout) :: sdat real(r8) , optional , pointer :: fld(:) character(len=*) , optional , intent(in) :: fldname @@ -1263,7 +1256,6 @@ subroutine dshr_restart_write(rpfile, case_name, model_name, inst_suffix, ymd, t type(var_desc_t) :: varid type(io_desc_t) :: pio_iodesc integer :: rcode - integer :: yy, mm, dd character(*), parameter :: F00 = "('(dshr_restart_write) ',2a,2(i0,2x))" !------------------------------------------------------------------------------- @@ -1345,7 +1337,7 @@ subroutine dshr_state_getscalar(state, scalar_id, scalar_value, flds_scalar_name integer, intent(inout) :: rc ! local variables - integer :: mytask, ierr, len + integer :: mytask type(ESMF_VM) :: vm type(ESMF_Field) :: field real(r8), pointer :: farrayptr(:,:) @@ -1572,6 +1564,7 @@ subroutine dshr_orbital_update(clock, logunit, mastertask, eccen, obliqr, lambm if ( eccen == SHR_ORB_UNDEF_REAL .or. obliqr == SHR_ORB_UNDEF_REAL .or. & mvelpp == SHR_ORB_UNDEF_REAL .or. lambm0 == SHR_ORB_UNDEF_REAL) then write (msgstr, *) subname//' ERROR: orb params incorrect' + write (logunit, *) msgstr call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) return ! bail out endif @@ -1596,7 +1589,6 @@ real(R8) function getNextRadCDay_i8( ymd, tod, stepno, dtime, iradsw, calendar ) real(R8) :: nextsw_cday real(R8) :: julday integer :: liradsw - integer :: yy,mm,dd character(*),parameter :: subName = '(getNextRadCDay) ' !------------------------------------------------------------------------------- diff --git a/dwav/CMakeLists.txt b/dwav/CMakeLists.txt index 27dced49e..c848741c6 100644 --- a/dwav/CMakeLists.txt +++ b/dwav/CMakeLists.txt @@ -16,4 +16,4 @@ target_include_directories (dwav PUBLIC "${CMAKE_BINARY_DIR}/dshr") target_include_directories (dwav PUBLIC "${CMAKE_SOURCE_DIR}") target_include_directories (dwav PUBLIC "${CMAKE_BINARY_DIR}/share") target_include_directories (dwav PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (dwav PUBLIC "${PIO_INCDIR}") +target_include_directories (dwav PUBLIC "${PIO_Fortran_INCLUDE_DIR}") diff --git a/dwav/cime_config/buildnml b/dwav/cime_config/buildnml index 2cb326ded..88e4b19cd 100755 --- a/dwav/cime_config/buildnml +++ b/dwav/cime_config/buildnml @@ -10,8 +10,13 @@ import os, sys -_CIMEROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..","..","..","..","..") -sys.path.append(os.path.join(_CIMEROOT, "scripts", "Tools")) +_CDEPS_CONFIG = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,os.pardir,"cime_config") +_CIMEROOT = os.environ.get("CIMEROOT") +if _CIMEROOT is None: + raise SystemExit("ERROR: must set CIMEROOT environment variable") +_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") +sys.path.append(_LIBDIR) +sys.path.append(_CDEPS_CONFIG) from standard_script_setup import * from CIME.case import Case @@ -19,6 +24,7 @@ from CIME.XML.files import Files from CIME.nmlgen import NamelistGenerator from CIME.utils import expect, safe_copy from CIME.buildnml import create_namelist_infile, parse_input, copy_inputs_to_rundir +from stream_cdeps import StreamCDEPS logger = logging.getLogger(__name__) @@ -33,7 +39,6 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path different instances. The `confdir` argument is used to specify the directory in which output files will be placed. """ - #---------------------------------------------------- # Write out dwav_in and dwav.streams.xml #---------------------------------------------------- @@ -60,6 +65,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path expect(not scol_mode, "for, DWAV single column mode is not allowed") + # Initialize nmlgen nmlgen.init_defaults(infile, config) # Generate dwav_in @@ -67,9 +73,12 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path nmlgen.write_output_file(namelist_file, data_list_path, groups=['dwav_nml']) # Generate dwav.streams.xml - streams = nmlgen.get_streams() - stream_path = os.path.join(confdir, "dwav.streams"+inst_string+".xml" ) - nmlgen.create_nuopc_stream_files(config, caseroot, streams, stream_path, data_list_path) + streamlist = nmlgen.get_streams() + stream_file = os.path.join(_CDEPS_CONFIG,os.pardir, "dwav","cime_config","stream_definition_dwav.xml") + schema_file = os.path.join(_CDEPS_CONFIG,"streams_v2.0.xsd") + streams = StreamCDEPS(stream_file, schema_file) + outfile = os.path.join(confdir, "dwav.streams"+inst_string+".xml" ) + streams.create_stream_xml(streamlist, case, outfile, data_list_path) ############################################################################### def buildnml(case, caseroot, compname): diff --git a/dwav/cime_config/namelist_definition_dwav.xml b/dwav/cime_config/namelist_definition_dwav.xml index 7f72aad34..6707ed013 100644 --- a/dwav/cime_config/namelist_definition_dwav.xml +++ b/dwav/cime_config/namelist_definition_dwav.xml @@ -4,26 +4,17 @@ - - strm_year_first is the first year of the stream data that will be used - strm_year_last is the last year of the stream data that will be used - strm_year_align is the model year that will be aligned with stream data for year_first - - For cplhist forcing - the following substitutions will be made below - Replace any instance of the following substring indicators with the appropriate values: - %y => year from the range yearfirst to yearlast - obtained from values of -> below - %ym => year-month from the range yearfirst to yearlast with all 12 months - obtained from values of -> below - %ymd => year-month-day from the range yearfirst to yearlast with all 12 months - obtained from values of -> below - --> - - - - + + char(100) + streams + streams_file + List of streams used for the given dwav_mode. + + climo + + char @@ -37,224 +28,14 @@ Copies all fields directly from the input data streams Any required fields not found on an input stream will be set to zero. Set by the following xml variables in env_run.xml DWAV_MODE - specifies values for wav mode: copyall,null + specifies values for wav mode: copyall copyall - - - - - - char(100) - streams - streams_file - List of streams used for the given dwav_mode. - - climo - - - - - char - streams - streams_file - Stream domain file directory. - - - $DIN_LOC_ROOT/share/meshes/ww3a_120222_ESMFmesh.nc - - - - - - char - streams - streams_file - Stream data file path(s). - - - $DIN_LOC_ROOT/wav/dwav/waveclim.mon.ww3a.150612.nc - - - - - - char - streams - streams_file - Stream data variable name(s). - - - lamult Sw_lamult - ustokes Sw_ustokes - vstokes Sw_vstokes - - - - - - integer - streams - streams_file - Stream offset. - - 0 - - - - - integer - streams - streams_file - Simulation year to align stream to. - - 1 - - - - - integer - streams - streams_file - First year of stream. - - 1 - - - - - integer - streams - streams_file - Last year of stream. - - 1 - - - - - char(30) - streams - streams_file - bilinear,nn - - array (up to 30 elements) of fill algorithms associated with the array of streams - valid values: nn,bilinear - - - bilinear - - - - - char(30) - streams - streams_file - coszen,nearest,linear,lower,upper - - array (up to 30 elements) of time interpolation options associated with the array of - streams. - valid values: lower,upper,nearest,linear,coszen - lower = Use lower time-value - upper = Use upper time-value - nearest = Use the nearest time-value - linear = Linearly interpolate between the two time-values - coszen = Scale according to the cosine of the solar zenith angle (for solar) - - - linear - - - - - char(30) - streams - streams_file - extend,cycle,limit - - array of time axis modes associated with the array of streams for - handling data outside the specified stream time axis. - valid options are to cycle the data based on the first, last, and - align settings associated with the stream dataset, to extend the first - and last valid value indefinitely, or to limit the interpolated data - to fall only between the least and greatest valid value of the time array. - valid values: cycle,extend,limit - extend = extrapolate before and after the period by using the first or last value. - cycle = cycle between the range of data - limit = restrict to the period for which the data is valid - - - cycle - - - - - char(30) - streams - streams_file - single,full_file - - array (up to 30 elements) of reading mode associated with the array of - streams. specifies the mode of reading temporal stream dataset. - valid options are "single" (read temporal dataset one at a time) or - "full_file" (read all entires of temporal dataset in a given netcdf file) - valid values: single,full_file - - - single - - - - - real(30) - streams - streams_file - - array (up to 30 elements) of delta time ratio limits placed on the - time interpolation associated with the array of streams. this real - value causes the model to stop if the ratio of the running maximum - delta time divided by the minimum delta time is greater than the - dtlimit for that stream. for instance, with daily data, the delta - time should be exactly one day throughout the dataset and the computed - maximum divided by minimum delta time should always be 1.0. for - monthly data, the delta time should be between 28 and 31 days and the - maximum ratio should be about 1.1. the running value of the delta - time is computed as data is read and any wraparound or cycling is also - included. this input helps trap missing data or errors in cycling. - to turn off trapping, set the value to 1.0e30 or something similar. - - - 1.5e0 - - - - - char - streams - streams_file - - list of paired colon delimited field names that should be treated as - vectors when carrying out spatial interpolation. unlike other - character arrays in this namelist, this array is completely decoupled - from the list of streams. this is a list of vector pairs that span - all input streams where different fields of the vector pair could - appear in different streams. - for example, vectors = 'u:v','taux:tauy'. - - - null - - - - - - - - + char streams abs diff --git a/dwav/cime_config/stream_definition_dwav.xml b/dwav/cime_config/stream_definition_dwav.xml new file mode 100644 index 000000000..9bd1ecaab --- /dev/null +++ b/dwav/cime_config/stream_definition_dwav.xml @@ -0,0 +1,40 @@ + + + + + + + + + $DIN_LOC_ROOT/share/meshes/ww3a_120222_ESMFmesh.nc + + + $DIN_LOC_ROOT/wav/dwav/waveclim.mon.ww3a.150612.nc + + + lamult Sw_lamult + ustokes Sw_ustokes + vstokes Sw_vstokes + + null + + bilinear + + null + 1 + 1 + 1 + 0 + + linear + + + cycle + + + 1.5 + + single + + + diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index b9999b94b..0fe275baa 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -24,7 +24,6 @@ module wav_comp_nuopc use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize - use perf_mod , only : t_startf, t_stopf, t_adj_detailf, t_barrierf implicit none private ! except @@ -76,7 +75,6 @@ module wav_comp_nuopc character(*) , parameter :: modName = "(wav_comp_nuopc)" ! linked lists - type(fldList_type) , pointer :: fldsImport => null() type(fldList_type) , pointer :: fldsExport => null() type(dfield_type) , pointer :: dfields => null() @@ -147,7 +145,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! local variables integer :: inst_index ! number of current instance (ie. 1) - character(len=CL) :: cvalue ! temporary integer :: nu ! unit number integer :: ierr ! error code logical :: exists @@ -257,14 +254,13 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: current_mon ! model month integer :: current_day ! model day integer :: current_tod ! model sec into model date - character(CL) :: cvalue ! temporary character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS ! Initialize sdat - create the model domain mesh and intialize the sdat clock - call t_startf('dwav_strdata_init') + call ESMF_TraceRegionEnter('dwav_strdata_init') call dshr_mesh_init(gcomp, nullstr, logunit, 'WAV', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) @@ -274,7 +270,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) xmlfilename = 'dwav.streams'//trim(inst_suffix)//'.xml' call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'WAV', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('dwav_strdata_init') + call ESMF_TraceRegionExit('dwav_strdata_init') ! Realize the actively coupled fields, now that a mesh is established and ! initialize dfields data type (to map streams to export state fields) @@ -294,7 +290,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call shr_cal_ymd2date(current_year, current_mon, current_day, current_ymd) ! Run dwav to create export state - call dwav_comp_run(mpicom, my_task, logunit, current_ymd, current_tod, sdat, rc=rc) + call dwav_comp_run(logunit, current_ymd, current_tod, sdat, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Add scalars to export state @@ -328,7 +324,7 @@ subroutine ModelAdvance(gcomp, rc) rc = ESMF_SUCCESS - call t_startf(subname) + call ESMF_TraceRegionEnter(subname) call memcheck(subname, 5, my_task == master_task) ! query the Component for its clock, importState and exportState @@ -346,7 +342,7 @@ subroutine ModelAdvance(gcomp, rc) call shr_cal_ymd2date(yr, mon, day, next_ymd) ! run dwav - call dwav_comp_run(mpicom, my_task, logunit, next_ymd, next_tod, sdat, rc=rc) + call dwav_comp_run(logunit, next_ymd, next_tod, sdat, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! write_restart if alarm is ringing @@ -357,13 +353,13 @@ subroutine ModelAdvance(gcomp, rc) call ESMF_AlarmRingerOff( alarm, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_startf('dwav_restart') + call ESMF_TraceRegionEnter('dwav_restart') call NUOPC_CompAttributeGet(gcomp, name='case_name', value=case_name, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_restart_write(rpfile, case_name, 'dwav', inst_suffix, next_ymd, next_tod, & - logunit, mpicom, my_task, sdat) - call t_stopf('dwav_restart') + logunit, my_task, sdat) + call ESMF_TraceRegionExit('dwav_restart') endif ! Write Diagnostics @@ -372,7 +368,7 @@ subroutine ModelAdvance(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - call t_stopf(subname) + call ESMF_TraceRegionExit(subname) end subroutine ModelAdvance @@ -438,7 +434,6 @@ subroutine dwav_comp_realize(importState, exportState, rc) integer , intent(out) :: rc ! local variables - character(CS), allocatable :: strm_flds(:) character(*), parameter :: subName = "(dwav_comp_realize) " ! ---------------------------------------------- @@ -468,15 +463,13 @@ subroutine dwav_comp_realize(importState, exportState, rc) end subroutine dwav_comp_realize !=============================================================================== - subroutine dwav_comp_run(mpicom, my_task, logunit, target_ymd, target_tod, sdat, rc) + subroutine dwav_comp_run(logunit, target_ymd, target_tod, sdat, rc) ! -------------------------- ! advance dwav ! -------------------------- ! input/output variables: - integer , intent(in) :: mpicom ! mpi communicator - integer , intent(in) :: my_task integer , intent(in) :: logunit integer , intent(in) :: target_ymd ! model date integer , intent(in) :: target_tod ! model sec into model date @@ -484,41 +477,39 @@ subroutine dwav_comp_run(mpicom, my_task, logunit, target_ymd, target_tod, sdat, integer , intent(out) :: rc !------------------------------------------------------------------------------- - call t_startf('DWAV_RUN') + call ESMF_TraceRegionEnter('DWAV_RUN') !-------------------- ! advance dwav streams !-------------------- ! time and spatially interpolate to model time and grid - call t_barrierf('dwav_BARRIER',mpicom) - call t_startf('dwav_strdata_advance') + call ESMF_TraceRegionEnter('dwav_strdata_advance') call shr_strdata_advance(sdat, target_ymd, target_tod, logunit, 'dwav', rc=rc) - call t_stopf('dwav_strdata_advance') + call ESMF_TraceRegionExit('dwav_strdata_advance') !-------------------- ! copy all fields from streams to export state as default !-------------------- ! This automatically will update the fields in the export state - call t_barrierf('dwav_comp_strdata_copy_BARRIER', mpicom) - call t_startf('dwav_strdata_copy') + call ESMF_TraceRegionEnter('dwav_strdata_copy') call dshr_dfield_copy(dfields, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf('dwav_strdata_copy') + call ESMF_TraceRegionExit('dwav_strdata_copy') !------------------------------------------------- ! determine data model behavior based on the mode !------------------------------------------------- - call t_startf('dwav_datamode') + call ESMF_TraceRegionEnter('dwav_datamode') select case (trim(datamode)) case('copyall') ! do nothing end select - call t_stopf('dwav_datamode') + call ESMF_TraceRegionExit('dwav_datamode') - call t_stopf('DWAV_RUN') + call ESMF_TraceRegionExit('DWAV_RUN') end subroutine dwav_comp_run diff --git a/fox b/fox new file mode 160000 index 000000000..7b9488446 --- /dev/null +++ b/fox @@ -0,0 +1 @@ +Subproject commit 7b9488446b193192dd3f0378541e71099cb4e8a8 diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 8c8e5a701..06bb2c7d3 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -20,7 +20,8 @@ add_library(cdeps_share ${GenF90_SRCS} shr_precip_mod.F90 shr_string_mod.F90) -target_include_directories (cdeps_share PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${ESMF_F90COMPILEPATHS} ${PIO_INCDIR}) +target_include_directories (cdeps_share PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${ESMF_F90COMPILEPATHS} ${PIO_Fortran_INCLUDE_DIRS}) + #===== genf90 ===== if (DEFINED GENF90_PATH) diff --git a/share/glc_elevclass_mod.F90 b/share/glc_elevclass_mod.F90 index 3a984f642..b44fbb91d 100644 --- a/share/glc_elevclass_mod.F90 +++ b/share/glc_elevclass_mod.F90 @@ -165,7 +165,6 @@ function glc_get_num_elevation_classes() result(num_elevation_classes) ! ! !ARGUMENTS: integer :: num_elevation_classes ! function result - integer :: rc ! ! !LOCAL VARIABLES: diff --git a/share/shr_assert_mod.F90.in b/share/shr_assert_mod.F90.in index fc62d64ba..978a3c5a9 100644 --- a/share/shr_assert_mod.F90.in +++ b/share/shr_assert_mod.F90.in @@ -80,7 +80,8 @@ subroutine shr_assert(var, msg, file, line) integer , intent(in), optional :: line character(len=:), allocatable :: full_msg - + + full_msg = '' if (.not. var) then full_msg = 'ERROR' if (present(file)) then diff --git a/share/shr_cal_mod.F90 b/share/shr_cal_mod.F90 index ada1c396f..086fbec53 100644 --- a/share/shr_cal_mod.F90 +++ b/share/shr_cal_mod.F90 @@ -523,8 +523,8 @@ subroutine shr_cal_date2ymd_long (date,year,month,day) tdate = abs(date) year =int( tdate /10000) if (date < 0) year = -year - month=int( mod(tdate,10000_SHR_KIND_I8)/ 100) - day = mod(tdate, 100_SHR_KIND_I8) + month=int( mod(tdate,10000_SHR_KIND_I8)/100, SHR_KIND_IN) + day =int( mod(tdate, 100_SHR_KIND_I8), SHR_KIND_IN) if (debug > 1) write(s_logunit,*) trim(subname),'_b ',year,month,day @@ -798,8 +798,8 @@ subroutine shr_cal_advDate_int(delta,units,dateIN,secIN,dateOUT,secOUT,calendar) i8dsec = i8dsec - i8dday*spd ! convert to i4 - idday = i8dday - idsec = i8dsec + idday = int(i8dday, SHR_KIND_I4) + idsec = int(i8dsec, SHR_KIND_I4) calkind = ESMF_CALKIND_NOLEAP lcalendar = shr_cal_calendarName(calendar) @@ -885,8 +885,8 @@ subroutine shr_cal_advDate_long(delta,units,dateIN,secIN,dateOUT,secOUT,calendar i8dsec = i8dsec - i8dday*spd ! convert to i4 - idday = i8dday - idsec = i8dsec + idday = int(i8dday, SHR_KIND_I4) + idsec = int(i8dsec, SHR_KIND_I4) calkind = ESMF_CALKIND_NOLEAP lcalendar = shr_cal_calendarName(calendar) diff --git a/share/shr_mpi_mod.F90 b/share/shr_mpi_mod.F90 index ab872a270..a5c29f8b4 100644 --- a/share/shr_mpi_mod.F90 +++ b/share/shr_mpi_mod.F90 @@ -91,8 +91,8 @@ Module shr_mpi_mod shr_mpi_maxr0, & shr_mpi_maxr1 end interface shr_mpi_max - -#include ! mpi library include file +! mpi library include file +#include !=============================================================================== CONTAINS diff --git a/share/shr_sys_mod.F90 b/share/shr_sys_mod.F90 index b89df7488..c7b40fdc7 100644 --- a/share/shr_sys_mod.F90 +++ b/share/shr_sys_mod.F90 @@ -92,7 +92,7 @@ SUBROUTINE shr_sys_system(str,rcode) #else - write(s_logunit,F00) 'ERROR: no implementation of system call for this architecture' + write(s_logunit,F00) 'ERROR: no implementation of system call for this architecture'//trim(str) call shr_sys_abort(subName//'no implementation of system call for this architecture') #endif #endif @@ -123,7 +123,7 @@ SUBROUTINE shr_sys_chdir(path, rcode) !------------------------------------------------------------------------------- ! PURPOSE: an architecture independent system call !------------------------------------------------------------------------------- - + rcode = 0 lenpath=len_trim(path) #if (defined AIX) diff --git a/streams/CMakeLists.txt b/streams/CMakeLists.txt index 750a88b22..013ee7a40 100644 --- a/streams/CMakeLists.txt +++ b/streams/CMakeLists.txt @@ -1,7 +1,7 @@ set(SRCFILES dshr_methods_mod.F90 - dshr_strdata_mod.F90 - dshr_stream_mod.F90 - dshr_tinterp_mod.F90) + dshr_strdata_mod.F90 + dshr_stream_mod.F90 + dshr_tinterp_mod.F90) set(MODFILES ${SRCFILES}) foreach(FILE ${SRCFILES}) list(TRANSFORM MODFILES REPLACE ".F90" ".mod") @@ -13,15 +13,16 @@ foreach(FILE ${SRCFILES}) endforeach() message("Stream srcfiles are ${SRCFILES}") add_library(streams ${SRCFILES}) +add_dependencies(streams FoX_dom) if(BLD_STANDALONE) add_dependencies(streams cdeps_share) endif() +target_include_directories (streams PUBLIC ${CMAKE_BINARY_DIR}/fox/include) target_include_directories (streams PUBLIC ${ESMF_F90COMPILEPATHS}) -target_include_directories (streams PUBLIC ${PIO_INCDIR}) -target_include_directories (streams PUBLIC ${FOX}/finclude) +target_include_directories (streams PUBLIC ${PIO_Fortran_INCLUDE_DIR}) target_include_directories (streams PUBLIC ${CMAKE_BINARY_DIR}/share) install(TARGETS streams - LIBRARY DESTINATION lib) + LIBRARY DESTINATION lib) foreach(MOD ${MODFILES}) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${MOD}" DESTINATION include) endforeach() diff --git a/streams/dshr_methods_mod.F90 b/streams/dshr_methods_mod.F90 index 861fc1093..b16d0ad4f 100644 --- a/streams/dshr_methods_mod.F90 +++ b/streams/dshr_methods_mod.F90 @@ -4,7 +4,6 @@ module dshr_methods_mod use ESMF use shr_kind_mod , only : r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl - use perf_mod , only : t_startf, t_stopf, t_adj_detailf, t_barrierf implicit none public @@ -30,7 +29,7 @@ module dshr_methods_mod contains !=============================================================================== - subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, rc) + subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, allowNullReturn, rc) ! ---------------------------------------------- ! Get pointer to a state field @@ -41,20 +40,39 @@ subroutine dshr_state_getfldptr(State, fldname, fldptr1, fldptr2, rc) character(len=*) , intent(in) :: fldname real(R8) , pointer, intent(inout), optional :: fldptr1(:) real(R8) , pointer, intent(inout), optional :: fldptr2(:,:) + logical , intent(in),optional :: allowNullReturn integer , intent(out) :: rc ! local variables - type(ESMF_Field) :: lfield + type(ESMF_Field) :: lfield + integer :: itemCount character(len=*), parameter :: subname='(dshr_state_getfldptr)' ! ---------------------------------------------- rc = ESMF_SUCCESS - call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return + if (present(allowNullReturn)) then + call ESMF_StateGet(State, itemSearch=trim(fldname), itemCount=itemCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! check field is in the state or not? + if (itemCount >= 1) then + call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call dshr_field_getfldptr(lfield, fldptr1=fldptr1, fldptr2=fldptr2, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + else + ! the call to just returns if it cannot find the field + call ESMF_LogWrite(trim(subname)//" Could not find the field: "//trim(fldname)//" just returning", ESMF_LOGMSG_INFO) + end if + else + call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_field_getfldptr(lfield, fldptr1=fldptr1, fldptr2=fldptr2, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return + call dshr_field_getfldptr(lfield, fldptr1=fldptr1, fldptr2=fldptr2, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + end if end subroutine dshr_state_getfldptr @@ -71,7 +89,7 @@ subroutine dshr_state_diagnose(State, flds_scalar_name, string, rc) integer , intent(out) :: rc ! local variables - integer :: i,j,n + integer :: n type(ESMf_Field) :: lfield integer :: fieldCount, lrank character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) @@ -192,7 +210,7 @@ subroutine dshr_fldbun_regrid(FBsrc, FBdst, RH, zeroregion, rc) rc = ESMF_SUCCESS - call t_startf(subname) + call ESMF_TraceRegionEnter(subname) localzr = ESMF_REGION_TOTAL if (present(zeroregion)) then @@ -235,7 +253,7 @@ subroutine dshr_fldbun_regrid(FBsrc, FBdst, RH, zeroregion, rc) deallocate(lfieldnamelist_src) deallocate(lfieldnamelist_dst) - call t_stopf(subname) + call ESMF_TraceRegionExit(subname) end subroutine dshr_fldbun_regrid @@ -409,7 +427,7 @@ subroutine dshr_fldbun_diagnose(FB, string, rc) integer , intent(out) :: rc ! local variables - integer :: i,j,n + integer :: n integer :: fieldCount, lrank character(ESMF_MAXSTR), pointer :: lfieldnamelist(:) character(len=CL) :: lstring diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 7821351f0..9a6d9af80 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -6,7 +6,7 @@ module dshr_strdata_mod use ESMF use shr_kind_mod , only : r8=>shr_kind_r8, r4=>shr_kind_r4, i2=>shr_kind_I2 - use shr_kind_mod , only : cs=>shr_kind_cs, cl=>shr_kind_cl, cxx=>shr_kind_cxx + use shr_kind_mod , only : cs=>shr_kind_cs, cl=>shr_kind_cl, cxx=>shr_kind_cxx use shr_sys_mod , only : shr_sys_abort use shr_const_mod , only : shr_const_pi, shr_const_cDay, shr_const_spval use shr_cal_mod , only : shr_cal_calendarname, shr_cal_timeSet @@ -29,11 +29,10 @@ module dshr_strdata_mod use pio , only : pio_openfile, pio_closefile, pio_nowrite use pio , only : pio_seterrorhandling, pio_initdecomp, pio_freedecomp use pio , only : pio_inquire, pio_inq_varid, pio_inq_varndims, pio_inq_vardimid - use pio , only : pio_inq_dimlen, pio_inq_vartype, pio_inq_dimname + use pio , only : pio_inq_dimlen, pio_inq_vartype, pio_inq_dimname, pio_inq_dimid use pio , only : pio_double, pio_real, pio_int, pio_offset_kind, pio_get_var use pio , only : pio_read_darray, pio_setframe, pio_fill_double, pio_get_att use pio , only : PIO_BCAST_ERROR, PIO_RETURN_ERROR, PIO_NOERR, PIO_INTERNAL_ERROR, PIO_SHORT - use perf_mod , only : t_startf, t_stopf, t_adj_detailf implicit none private @@ -45,12 +44,19 @@ module dshr_strdata_mod public :: shr_strdata_advance public :: shr_strdata_get_stream_domain ! public since needed by dshr_mod public :: shr_strdata_get_stream_pointer ! get a pointer into a stream's fldbun_model field bundle - public :: shr_strdata_print public :: shr_strdata_get_stream_count public :: shr_strdata_get_stream_fieldbundle + public :: shr_strdata_print + private :: shr_strdata_init_model_domain + private :: shr_strdata_get_stream_nlev private :: shr_strdata_readLBUB + interface shr_strdata_get_stream_pointer + module procedure shr_strdata_get_stream_pointer_1d + module procedure shr_strdata_get_stream_pointer_2d + end interface shr_strdata_get_stream_pointer + ! public data members: integer :: debug = 0 ! local debug flag character(len=*) ,parameter, public :: shr_strdata_nullstr = 'null' @@ -67,6 +73,7 @@ module dshr_strdata_mod type(ESMF_RouteHandle) :: routehandle ! stream n -> model mesh mapping character(CL), allocatable :: fldlist_stream(:) ! names of stream file fields character(CL), allocatable :: fldlist_model(:) ! names of stream model fields + integer :: stream_nlev ! number of vertical levels in stream integer :: stream_lb ! index of the Lowerbound (LB) in fldlist_stream integer :: stream_ub ! index of the Upperbound (UB) in fldlist_stream type(ESMF_Field) :: field_stream ! a field on the stream data domain @@ -164,9 +171,7 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn ! local variables type(ESMF_VM) :: vm - integer :: i integer :: localPet - integer :: ierr character(len=*), parameter :: subname='(shr_strdata_init_from_xml)' ! ---------------------------------------------- @@ -203,20 +208,23 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn end subroutine shr_strdata_init_from_xml - !=============================================================================== - subroutine shr_strdata_init_from_inline(sdat, my_task, logunit, compname, model_clock, model_mesh,& - stream_meshfile, stream_mapalgo, stream_filenames, stream_fldlistFile, stream_fldListModel, & - stream_yearFirst, stream_yearLast, stream_yearAlign, stream_offset, stream_taxmode, rc) + subroutine shr_strdata_init_from_inline(sdat, my_task, logunit, compname, & + model_clock, model_mesh, & + stream_meshfile, stream_lev_dimname, stream_mapalgo, & + stream_filenames, stream_fldlistFile, stream_fldListModel, & + stream_yearFirst, stream_yearLast, stream_yearAlign, & + stream_offset, stream_taxmode, stream_dtlimit, stream_tintalgo, rc) ! input/output variables type(shr_strdata_type) , intent(inout) :: sdat ! stream data type integer , intent(in) :: my_task ! my mpi task integer , intent(in) :: logunit ! stdout logunit - character(len=*) , intent(in) :: compname ! component name (e.g. ATM, OCN, ...) + character(len=*) , intent(in) :: compname ! component name (e.g. ATM, OCN, ...) type(ESMF_Clock) , intent(in) :: model_clock ! model clock type(ESMF_Mesh) , intent(in) :: model_mesh ! model mesh character(*) , intent(in) :: stream_meshFile ! full pathname to stream mesh file + character(*) , intent(in) :: stream_lev_dimname ! name of vertical dimension in stream character(*) , intent(in) :: stream_mapalgo ! stream mesh -> model mesh mapping type character(*) , intent(in) :: stream_filenames(:) ! stream data filenames (full pathnamesa) character(*) , intent(in) :: stream_fldListFile(:) ! file field names, colon delim list @@ -226,6 +234,8 @@ subroutine shr_strdata_init_from_inline(sdat, my_task, logunit, compname, model_ integer , intent(in) :: stream_yearAlign ! align yearFirst with this model year integer , intent(in) :: stream_offset ! offset in seconds of stream data character(*) , intent(in) :: stream_taxMode ! time axis mode + real(r8) , intent(in) :: stream_dtlimit ! ratio of max/min stream delta times + character(*) , intent(in) :: stream_tintalgo ! time interpolation algorithm integer , intent(out) :: rc ! error code ! ---------------------------------------------- @@ -249,9 +259,12 @@ subroutine shr_strdata_init_from_inline(sdat, my_task, logunit, compname, model_ if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize sdat stream - ASSUME only 1 stream - call shr_stream_init_from_inline(sdat%stream, stream_meshfile, stream_mapalgo, & - stream_yearFirst, stream_yearLast, stream_yearAlign, stream_offset, stream_taxmode, & - stream_fldlistFile, stream_fldListModel, stream_fileNames, logunit, trim(compname)) + call shr_stream_init_from_inline(sdat%stream, & + stream_meshfile, stream_lev_dimname, stream_mapalgo, & + stream_yearFirst, stream_yearLast, stream_yearAlign, & + stream_offset, stream_taxmode, stream_tintalgo, stream_dtlimit, & + stream_fldlistFile, stream_fldListModel, stream_fileNames, & + logunit, trim(compname)) ! Now finish initializing sdat call shr_strdata_init(sdat, model_clock, rc) @@ -271,18 +284,13 @@ subroutine shr_strdata_init_model_domain( sdat, rc) integer , intent(out) :: rc ! local variables - integer :: n,k ! generic counters + integer :: n ! generic counters type(ESMF_DistGrid) :: distGrid - integer :: dimCount integer :: tileCount integer, allocatable :: elementCountPTile(:) - integer, allocatable :: indexCountPDE(:,:) integer :: spatialDim ! number of dimension in mesh integer :: numOwnedElements ! local size of mesh real(r8), allocatable :: ownedElemCoords(:) ! mesh lat and lons - integer :: my_task - integer :: ierr - integer :: rcode ! ---------------------------------------------- rc = ESMF_SUCCESS @@ -335,60 +343,47 @@ subroutine shr_strdata_init(sdat, model_clock, rc) integer , intent(out) :: rc ! local variables + type(ESMF_Mesh), pointer :: stream_mesh type(ESMF_Calendar) :: esmf_calendar ! esmf calendar type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type - type(ESMF_DistGrid) :: distgrid - type(ESMF_RegridMethod_Flag) :: regridmethod - type(ESMF_PoleMethod_Flag) :: polemethod character(CS) :: calendar ! calendar name - integer :: dimcount - integer, allocatable :: minIndexPTile(:,:) - integer, allocatable :: maxIndexPTile(:,:) - integer :: lnx, lny ! global mesh dimensions - integer :: ne ! number of local mesh elements integer :: ns ! stream index - integer :: n,m,k ! generic index + integer :: m ! generic index character(CL) :: fileName ! generic file name - integer :: nfiles ! number of data files for a given stream - character(CS) :: uname ! u vector field name - character(CS) :: vname ! v vector field name - integer :: nu, nv ! vector indices - integer :: nstream ! loop stream index - integer :: nvector ! loop vector index integer :: nfld ! loop stream field index - integer :: nflds ! total number of fields in a given stream type(ESMF_Field) :: lfield ! temporary type(ESMF_Field) :: lfield_dst ! temporary integer :: srcTermProcessing_Value = 0 ! should this be a module variable? - integer , pointer :: stream_gindex(:) - integer :: stream_lsize - character(CS) :: tmpstr - integer :: ierr integer :: localpet logical :: fileExists type(ESMF_VM) :: vm logical :: masterproc integer :: nvars - integer :: i + integer :: i, stream_nlev, index + character(CL) :: stream_vectors character(len=*), parameter :: subname='(shr_strdata_mod:shr_sdat_init)' character(*) , parameter :: F00 = "('(shr_sdat_init) ',a)" character(*) , parameter :: F01 = "('(shr_sdat) ',a,2x,i8)" - character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) ! ---------------------------------------------- rc = ESMF_SUCCESS + call ESMF_VmGetCurrent(vm, rc=rc) call ESMF_VMGet(vm, localpet=localPet, rc=rc) - masterproc= localPet==master_task + masterproc= (localPet==master_task) + ! Loop over streams do ns = 1,shr_strdata_get_stream_count(sdat) + ! Initialize calendar for stream n call ESMF_VMBroadCast(vm, sdat%stream(ns)%calendar, CS, 0, rc=rc) + ! Set pointer for stream_mesh + stream_mesh => sdat%pstrm(ns)%stream_mesh + ! Create the target stream mesh from the stream mesh file ! TODO: add functionality if the stream mesh needs to be created from a grid call shr_stream_getMeshFileName (sdat%stream(ns), filename) - if (filename /= 'none' .and. masterproc) then inquire(file=trim(filename),exist=fileExists) if (.not. fileExists) then @@ -397,16 +392,20 @@ subroutine shr_strdata_init(sdat, model_clock, rc) end if endif if(filename /= 'none') then - sdat%pstrm(ns)%stream_mesh = ESMF_MeshCreate(trim(filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + stream_mesh = ESMF_MeshCreate(trim(filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) endif if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Determine the number of stream levels + call shr_strdata_get_stream_nlev(sdat, ns, rc=rc) + stream_nlev = sdat%pstrm(ns)%stream_nlev + ! Determine field names for stream fields with both stream file names and data model names nvars = sdat%stream(ns)%nvars + ! Allocate memory allocate(sdat%pstrm(ns)%fldList_model(nvars)) call shr_stream_getModelFieldList(sdat%stream(ns), sdat%pstrm(ns)%fldlist_model) - allocate(sdat%pstrm(ns)%fldlist_stream(nvars)) call shr_stream_getStreamFieldList(sdat%stream(ns), sdat%pstrm(ns)%fldlist_stream) @@ -416,32 +415,60 @@ subroutine shr_strdata_init(sdat, model_clock, rc) sdat%pstrm(ns)%stream_ub = 2 allocate(sdat%pstrm(ns)%fldbun_data(2)) else if(sdat%stream(ns)%readmode=='full_file') then - - + ! TODO: add this in endif + + ! create spatially interpolated (but not time interpolated) field bundle - fldbun_data array do i=1,size(sdat%pstrm(ns)%fldbun_data) sdat%pstrm(ns)%fldbun_data(i) = ESMF_FieldBundleCreate(rc=rc) ! stream mesh enddo - sdat%pstrm(ns)%fldbun_model = ESMF_FieldBundleCreate(rc=rc) ! time interpolation on model mesh do nfld = 1, nvars - ! create temporary fields on model mesh and add the fields to the field bundle do i=1,size(sdat%pstrm(ns)%fldbun_data) - lfield = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_r8, name=trim(sdat%pstrm(ns)%fldlist_model(nfld)), & - meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (sdat%pstrm(ns)%stream_nlev > 1) then + lfield = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_r8, & + name=trim(sdat%pstrm(ns)%fldlist_model(nfld)), & + ungriddedLbound=(/1/), ungriddedUbound=(/stream_nlev/), gridToFieldMap=(/2/), & + meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + else + lfield = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_r8, & + name=trim(sdat%pstrm(ns)%fldlist_model(nfld)), & + meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + end if call ESMF_FieldBundleAdd(sdat%pstrm(ns)%fldbun_data(i), (/lfield/), rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return enddo - lfield = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_r8, name=trim(sdat%pstrm(ns)%fldlist_model(nfld)), & - meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) - call ESMF_FieldBundleAdd(sdat%pstrm(ns)%fldbun_model , (/lfield/), rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return end do + ! Create spatially and time interpolated field bundle - fldbun_model + sdat%pstrm(ns)%fldbun_model = ESMF_FieldBundleCreate(rc=rc) ! time interpolation on model mesh + do nfld = 1, nvars + ! create temporary fields on model mesh and add the fields to the field bundle + if (stream_nlev > 1) then + lfield = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_r8, & + ungriddedLbound=(/1/), ungriddedUbound=(/stream_nlev/), gridToFieldMap=(/2/), & + name=trim(sdat%pstrm(ns)%fldlist_model(nfld)), & + meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + else + lfield = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_r8, & + name=trim(sdat%pstrm(ns)%fldlist_model(nfld)), & + meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + end if + call ESMF_FieldBundleAdd(sdat%pstrm(ns)%fldbun_model, (/lfield/), rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + end do ! Create a field on the model mesh for coszen time interpolation for this stream if needed if (trim(sdat%stream(ns)%tinterpalgo) == 'coszen') then - sdat%pstrm(ns)%field_coszen = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_r8, name='tavCosz', & - meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (stream_nlev > 1) then + sdat%pstrm(ns)%field_coszen = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_r8, & + name='tavCosz', & + ungriddedLbound=(/1/), ungriddedUbound=(/stream_nlev/), gridToFieldMap=(/2/), & + meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + else + sdat%pstrm(ns)%field_coszen = ESMF_FieldCreate(sdat%model_mesh, ESMF_TYPEKIND_r8, & + name='tavCosz', & + meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + end if endif ! ------------------------------------ @@ -451,12 +478,24 @@ subroutine shr_strdata_init(sdat, model_clock, rc) ! create the source and destination fields needed to create the route handles ! assume that all fields in a stream share the same mesh and there is only a unique model mesh ! can do this outside of a stream loop by just using the first stream index - if(ESMF_MeshIsCreated(sdat%pstrm(ns)%stream_mesh)) then - sdat%pstrm(ns)%field_stream = ESMF_FieldCreate(sdat%pstrm(ns)%stream_mesh, & - ESMF_TYPEKIND_r8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return + if(ESMF_MeshIsCreated(stream_mesh)) then + if (stream_nlev > 1) then + sdat%pstrm(ns)%field_stream = ESMF_FieldCreate(stream_mesh, & + ESMF_TYPEKIND_r8, meshloc=ESMF_MESHLOC_ELEMENT, & + ungriddedLbound=(/1/), ungriddedUbound=(/stream_nlev/), gridToFieldMap=(/2/), & + rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + else + sdat%pstrm(ns)%field_stream = ESMF_FieldCreate(stream_mesh, & + ESMF_TYPEKIND_r8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + end if endif - call dshr_fldbun_getFieldN(sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_lb), 1, lfield_dst, rc=rc) + + ! TODO: why not just use fldbun_model rather than fldbun_data + + index = sdat%pstrm(ns)%stream_lb + call dshr_fldbun_getFieldN(sdat%pstrm(ns)%fldbun_data(index), 1, lfield_dst, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (trim(sdat%stream(ns)%mapalgo) == "bilinear") then @@ -491,24 +530,32 @@ subroutine shr_strdata_init(sdat, model_clock, rc) end do ! end of loop over streams ! Check for vector pairs in the stream - BOTH ucomp and vcomp MUST BE IN THE SAME STREAM - do m = 1,shr_strdata_get_stream_count(sdat) + do ns = 1,shr_strdata_get_stream_count(sdat) + stream_mesh => sdat%pstrm(ns)%stream_mesh + stream_nlev = sdat%pstrm(ns)%stream_nlev + stream_vectors = trim(sdat%stream(ns)%stream_vectors) + ! check that vector field list is a valid colon delimited string - if (trim(sdat%stream(m)%stream_vectors) /= 'null') then + if (trim(stream_vectors) /= 'null') then + ! check that for now u and v are only for single leve fields + if (stream_nlev > 1) then + ! TODO: add support for u and v for multi level fields + call shr_sys_abort(subname//': vector fields are not currently supported for multi-level fields') + end if ! check that stream vector names are valid - if (.not. shr_string_listIsValid(sdat%stream(m)%stream_vectors)) then - write(sdat%logunit,*) trim(subname),' vec fldlist invalid m=',m,trim(sdat%stream(m)%stream_vectors) - call shr_sys_abort(subname//': vec fldlist invalid:'//trim(sdat%stream(m)%stream_vectors)) + if (.not. shr_string_listIsValid(stream_vectors)) then + write(sdat%logunit,*) trim(subname),' vec fldlist invalid m=',m,trim(stream_vectors) + call shr_sys_abort(subname//': vec fldlist invalid:'//trim(stream_vectors)) endif ! check that only 2 fields are contained for any vector pairing - if (shr_string_listGetNum(sdat%stream(m)%stream_vectors) /= 2) then - write(sdat%logunit,*) trim(subname),' vec fldlist ne 2 m=',m,trim(sdat%stream(m)%stream_vectors) - call shr_sys_abort(subname//': vec fldlist ne 2:'//trim(sdat%stream(m)%stream_vectors)) + if (shr_string_listGetNum(stream_vectors) /= 2) then + write(sdat%logunit,*) trim(subname),' vec fldlist ne 2 m=',m,trim(stream_vectors) + call shr_sys_abort(subname//': vec fldlist ne 2:'//trim(stream_vectors)) endif ! create stream vector field - sdat%pstrm(m)%stream_vector = ESMF_FieldCreate(sdat%pstrm(m)%stream_mesh, & - ESMF_TYPEKIND_r8, name='stream_vector', & - ungriddedLbound=(/1/), ungriddedUbound=(/2/), & - gridToFieldMap=(/2/), meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + sdat%pstrm(ns)%stream_vector = ESMF_FieldCreate(stream_mesh, & + ESMF_TYPEKIND_r8, name='stream_vector', meshloc=ESMF_MESHLOC_ELEMENT, & + ungriddedLbound=(/1/), ungriddedUbound=(/2/), gridToFieldMap=(/2/), rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return end if enddo @@ -532,6 +579,53 @@ subroutine shr_strdata_init(sdat, model_clock, rc) endif end subroutine shr_strdata_init + !=============================================================================== + subroutine shr_strdata_get_stream_nlev(sdat, stream_index, rc) + + ! Obtain the number of vertical levels for the stream - this is obtained + ! from the lev_dimname string + + ! input/output variables + type(shr_strdata_type) , intent(inout) :: sdat + integer , intent(in) :: stream_index + integer , intent(out) :: rc + + ! local variables + type(ESMF_VM) :: vm + type(file_desc_t) :: pioid + integer :: rcode + character(CL) :: filename + integer :: dimid + integer :: stream_nlev + character(*), parameter :: subname = '(shr_strdata_set_stream_domain) ' + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + ! Set ungridded dimension to the number of vertical level - must read this in + if (trim(sdat%stream(stream_index)%lev_dimname) == 'null') then + stream_nlev = 1 + else + call ESMF_VMGetCurrent(vm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (sdat%masterproc) then + call shr_stream_getData(sdat%stream(stream_index), 1, filename) + end if + call ESMF_VMBroadCast(vm, filename, CL, 0, rc=rc) + rcode = pio_openfile(sdat%pio_subsystem, pioid, sdat%io_type, trim(filename), pio_nowrite) + rcode = pio_inq_dimid(pioid, trim(sdat%stream(stream_index)%lev_dimname), dimid) + rcode = pio_inq_dimlen(pioid, dimid, stream_nlev) + call pio_closefile(pioid) + end if + if (sdat%masterproc) then + write(sdat%logunit,*) trim(subname)//' stream_nlev = ',stream_nlev + end if + + ! Set stream_nlev in the per-stream sdat info + sdat%pstrm(stream_index)%stream_nlev = stream_nlev + + end subroutine shr_strdata_get_stream_nlev + !=============================================================================== subroutine shr_strdata_get_stream_domain(sdat, stream_index, fldname, flddata, rc) @@ -572,8 +666,7 @@ subroutine shr_strdata_get_stream_domain(sdat, stream_index, fldname, flddata, r rcode = pio_openfile(sdat%pio_subsystem, pioid, sdat%io_type, trim(filename), pio_nowrite) ! Create the pio iodesc for fldname - call shr_strdata_set_stream_iodesc(sdat, sdat%pio_subsystem, pioid, & - trim(fldname), sdat%pstrm(stream_index)%stream_mesh, pio_iodesc, rc=rc) + call shr_strdata_set_stream_iodesc(sdat, sdat%pstrm(stream_index), trim(fldname), pioid, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Now read in the data for fldname @@ -656,23 +749,21 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) integer ,intent(out) :: rc ! local variables - integer :: ns !stream index + integer :: ns ! stream index integer :: nf ! field index - integer :: m ! vector index - integer :: n,i ! generic indices - integer :: ierr - integer :: nu,nv - integer :: lsize + integer :: i,lev ! generic indices logical , allocatable :: newData(:) integer , allocatable :: ymdmod(:) ! modified model dates to handle Feb 29 real(r8), allocatable :: coszen(:) ! cosine of zenith angle integer :: todmod ! modified model dates to handle Feb 29 character(len=32) :: lstr ! local string - logical :: ltimers ! local logical for timers real(r8) :: flb,fub ! factor for lb and ub - real(r8) ,pointer :: dataptr(:) ! pointer into field bundle - real(r8) ,pointer :: dataptr_lb(:) ! pointer into field bundle - real(r8) ,pointer :: dataptr_ub(:) ! pointer into field bundle + real(r8) ,pointer :: dataptr1d(:) ! pointer into field bundle + real(r8) ,pointer :: dataptr1d_lb(:) ! pointer into field bundle + real(r8) ,pointer :: dataptr1d_ub(:) ! pointer into field bundle + real(r8) ,pointer :: dataptr2d(:,:) ! pointer into field bundle + real(r8) ,pointer :: dataptr2d_lb(:,:)! pointer into field bundle + real(r8) ,pointer :: dataptr2d_ub(:,:)! pointer into field bundle real(r8), pointer :: nu_coords(:) ! allocatable local element mesh lat and lons real(r8), pointer :: nv_coords(:) ! allocatable local element mesh lat and lons real(r8), pointer :: data2d_src(:,:) ! pointer into field bundle @@ -686,35 +777,24 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) integer :: dday ! delta days real(r8) :: dtime ! delta time integer :: year,month,day ! date year month day - integer :: spatialDim ! spatial dimension of mesh - integer :: numOwnedElements ! local size of mesh - character(CS) :: uname ! u vector field name - character(CS) :: vname ! v vector field name - type(ESMF_Field) :: field_src - type(ESMF_Field) :: field_dst - real(r8) :: lon, lat - real(r8) :: sinlon, sinlat - real(r8) :: coslon, coslat - real(r8) :: ux, uy - logical :: checkflag = .false. - integer :: npes - integer :: my_task + integer :: nstreams + integer :: stream_index real(r8) ,parameter :: solZenMin = 0.001_r8 ! minimum solar zenith angle integer ,parameter :: tadj = 2 character(len=*) ,parameter :: timname = "_strd_adv" character(*) ,parameter :: subname = "(shr_strdata_advance) " character(*) ,parameter :: F00 = "('(shr_strdata_advance) ',a)" character(*) ,parameter :: F01 = "('(shr_strdata_advance) ',a,a,i4,2(f10.5,2x))" - real(r8), pointer :: dataptr_temp1(:) - real(r8), pointer :: dataptr_temp2(:) - integer :: nstreams !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - nullify(dataptr) - nullify(dataptr_ub) - nullify(dataptr_lb) + nullify(dataptr1d) + nullify(dataptr1d_ub) + nullify(dataptr1d_lb) + nullify(dataptr2d) + nullify(dataptr2d_ub) + nullify(dataptr2d_lb) nullify(nu_coords) nullify(nv_coords) nullify(data2d_src) @@ -723,19 +803,13 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) nullify(data_v_src) nullify(data_u_dst) nullify(data_v_dst) + nstreams = shr_strdata_get_stream_count(sdat) if (nstreams < 1) return ! TODO: is this needed lstr = trim(istr) - ltimers = .true. - if (present(timers)) then - ltimers = timers - endif - - if (.not.ltimers) call t_adj_detailf(tadj) - - call t_startf(trim(lstr)//trim(timname)//'_total') + call ESMF_TraceRegionEnter(trim(lstr)//trim(timname)//'_total') sdat%ymd = ymd sdat%tod = tod @@ -776,7 +850,7 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) ! fldbun_stream_ub to fldbun_stream_lb and read in new fldbun_stream_ub data ! --------------------------------------------------------- - call t_startf(trim(lstr)//trim(timname)//'_readLBUB') + call ESMF_TraceRegionEnter(trim(lstr)//trim(timname)//'_readLBUB') select case(sdat%stream(ns)%readmode) case ('single') @@ -809,25 +883,31 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) call shr_cal_timeSet(timeUB,sdat%pstrm(ns)%ymdUB,0,sdat%stream(ns)%calendar,rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return timeint = timeUB-timeLB - call ESMF_TimeIntervalGet(timeint,StartTimeIn=timeLB,d=dday) + call ESMF_TimeIntervalGet(timeint, StartTimeIn=timeLB, d=dday) if (ChkErr(rc,__LINE__,u_FILE_u)) return dtime = abs(real(dday,r8) + real(sdat%pstrm(ns)%todUB-sdat%pstrm(ns)%todLB,r8)/shr_const_cDay) sdat%pstrm(ns)%dtmin = min(sdat%pstrm(ns)%dtmin,dtime) sdat%pstrm(ns)%dtmax = max(sdat%pstrm(ns)%dtmax,dtime) + if ((sdat%pstrm(ns)%dtmax/sdat%pstrm(ns)%dtmin) > sdat%stream(ns)%dtlimit) then if (sdat%masterproc) then - write(sdat%logunit,*) trim(subname),' ERROR: for stream ',n - write(sdat%logunit,*) trim(subName),' ERROR: dt limit1 ',& - sdat%pstrm(ns)%dtmax, sdat%pstrm(ns)%dtmin, sdat%stream(ns)%dtlimit - write(sdat%logunit,*) trim(subName),' ERROR: dt limit2 ',& + write(sdat%logunit,*) trim(subname),' ERROR: for stream ',ns + write(sdat%logunit,*) trim(subName),' ERROR: dtime, dtmax, dtmin, dtlimit = ',& + dtime, sdat%pstrm(ns)%dtmax, sdat%pstrm(ns)%dtmin, sdat%stream(ns)%dtlimit + write(sdat%logunit,*) trim(subName),' ERROR: ymdLB, todLB, ymdUB, todUB = ', & sdat%pstrm(ns)%ymdLB, sdat%pstrm(ns)%todLB, sdat%pstrm(ns)%ymdUB, sdat%pstrm(ns)%todUB end if - call shr_sys_abort(trim(subName)//' ERROR dt limit for stream') + write(6,*) trim(subname),' ERROR: for stream ',ns + write(6,*) trim(subName),' ERROR: dtime, dtmax, dtmin, dtlimit = ',& + dtime, sdat%pstrm(ns)%dtmax, sdat%pstrm(ns)%dtmin, sdat%stream(ns)%dtlimit + write(6,*) trim(subName),' ERROR: ymdLB, todLB, ymdUB, todUB = ', & + sdat%pstrm(ns)%ymdLB, sdat%pstrm(ns)%todLB, sdat%pstrm(ns)%ymdUB, sdat%pstrm(ns)%todUB + call shr_sys_abort(trim(subName)//' ERROR dt limit for stream, see atm.log output') endif endif - call t_stopf(trim(lstr)//trim(timname)//'_readLBUB') + call ESMF_TraceRegionExit(trim(lstr)//trim(timname)//'_readLBUB') enddo ! end of loop over streams @@ -839,23 +919,26 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) if (trim(sdat%stream(ns)%tinterpalgo) == 'coszen') then + ! Determine stream lower bound index + stream_index = sdat%pstrm(ns)%stream_lb + ! ------------------------------------------ ! time interpolation method is coszen ! ------------------------------------------ - call t_startf(trim(lstr)//trim(timname)//'_coszen') + call ESMF_TraceRegionEnter(trim(lstr)//trim(timname)//'_coszen') allocate(coszen(sdat%model_lsize)) ! get coszen - call t_startf(trim(lstr)//trim(timname)//'_coszenC') + call ESMF_TraceRegionEnter(trim(lstr)//trim(timname)//'_coszenC') call shr_tInterp_getCosz(coszen, sdat%model_lon, sdat%model_lat, ymdmod(ns), todmod, & sdat%eccen, sdat%mvelpp, sdat%lambm0, sdat%obliqr, sdat%stream(ns)%calendar) - call t_stopf(trim(lstr)//trim(timname)//'_coszenC') + call ESMF_TraceRegionExit(trim(lstr)//trim(timname)//'_coszenC') ! get avg cosz factor if (newdata(ns)) then ! compute a new avg cosz - call t_startf(trim(lstr)//trim(timname)//'_coszenN') + call ESMF_TraceRegionEnter(trim(lstr)//trim(timname)//'_coszenN') if (.not. allocated(sdat%tavCoszen)) then allocate(sdat%tavCoszen(sdat%model_lsize)) end if @@ -863,28 +946,44 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) sdat%pstrm(ns)%ymdLB, sdat%pstrm(ns)%todLB, sdat%pstrm(ns)%ymdUB, sdat%pstrm(ns)%todUB, & sdat%eccen, sdat%mvelpp, sdat%lambm0, sdat%obliqr, sdat%modeldt, & sdat%stream(ns)%calendar, rc=rc) - call t_stopf(trim(lstr)//trim(timname)//'_coszenN') + call ESMF_TraceRegionExit(trim(lstr)//trim(timname)//'_coszenN') endif ! compute time interperpolate value - LB data normalized with this factor: cosz/tavCosz do nf = 1,size(sdat%pstrm(ns)%fldlist_model) - call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, & - sdat%pstrm(ns)%fldlist_model(nf), dataptr , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_lb), & - sdat%pstrm(ns)%fldlist_model(nf), dataptr_lb, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do i = 1,size(dataptr) - if (coszen(i) > solZenMin) then - dataptr(i) = dataptr_lb(i)*coszen(i)/sdat%tavCoszen(i) - else - dataptr(i) = 0._r8 - endif - end do + if (sdat%pstrm(ns)%stream_nlev > 1) then + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, & + sdat%pstrm(ns)%fldlist_model(nf), fldptr2=dataptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_data(stream_index), & + sdat%pstrm(ns)%fldlist_model(nf), fldptr2=dataptr2d_lb, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do i = 1,size(dataptr2d,dim=2) + if (coszen(i) > solZenMin) then + dataptr2d(:,i) = dataptr2d_lb(:,i)*coszen(i)/sdat%tavCoszen(i) + else + dataptr2d(:,i) = 0._r8 + endif + end do + else + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, & + sdat%pstrm(ns)%fldlist_model(nf), fldptr1=dataptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_data(stream_index), & + sdat%pstrm(ns)%fldlist_model(nf), fldptr1=dataptr1d_lb, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do i = 1,size(dataptr1d) + if (coszen(i) > solZenMin) then + dataptr1d(i) = dataptr1d_lb(i)*coszen(i)/sdat%tavCoszen(i) + else + dataptr1d(i) = 0._r8 + endif + end do + end if end do deallocate(coszen) - call t_stopf(trim(lstr)//trim(timname)//'_coszen') + call ESMF_TraceRegionExit(trim(lstr)//trim(timname)//'_coszen') elseif (trim(sdat%stream(ns)%tinterpalgo) /= trim(shr_strdata_nullstr)) then @@ -892,7 +991,7 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) ! time interpolation method is not coszen ! ------------------------------------------ - call t_startf(trim(lstr)//trim(timname)//'_tint') + call ESMF_TraceRegionEnter(trim(lstr)//trim(timname)//'_tint') call shr_tInterp_getFactors(sdat%pstrm(ns)%ymdlb, sdat%pstrm(ns)%todlb, & sdat%pstrm(ns)%ymdub, sdat%pstrm(ns)%todub, & ymdmod(ns), todmod, flb, fub, calendar=sdat%stream(ns)%calendar, logunit=sdat%logunit, & @@ -901,20 +1000,34 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) if (debug > 0 .and. sdat%masterproc) then write(sdat%logunit,F01) trim(subname),' interp = ',ns,flb,fub endif - do nf = 1,size(sdat%pstrm(ns)%fldlist_model) - call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, sdat%pstrm(ns)%fldlist_model(nf), dataptr, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_lb), & - sdat%pstrm(ns)%fldlist_model(nf), dataptr_lb, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_ub), & - sdat%pstrm(ns)%fldlist_model(nf), dataptr_ub, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - dataptr(:) = dataptr_lb(:) * flb + dataptr_ub(:) * fub + if (sdat%pstrm(ns)%stream_nlev > 1) then + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, & + sdat%pstrm(ns)%fldlist_model(nf), fldptr2=dataptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_lb), & + sdat%pstrm(ns)%fldlist_model(nf), fldptr2=dataptr2d_lb, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_ub), & + sdat%pstrm(ns)%fldlist_model(nf), fldptr2=dataptr2d_ub, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do lev = 1,sdat%pstrm(ns)%stream_nlev + dataptr2d(lev,:) = dataptr2d_lb(lev,:) * flb + dataptr2d_ub(lev,:) * fub + end do + else + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, & + sdat%pstrm(ns)%fldlist_model(nf), fldptr1=dataptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_lb), & + sdat%pstrm(ns)%fldlist_model(nf), fldptr1=dataptr1d_lb, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_ub), & + sdat%pstrm(ns)%fldlist_model(nf), fldptr1=dataptr1d_ub, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + dataptr1d(:) = dataptr1d_lb(:) * flb + dataptr1d_ub(:) * fub + end if end do - call t_stopf(trim(lstr)//trim(timname)//'_tint') + call ESMF_TraceRegionExit(trim(lstr)//trim(timname)//'_tint') else @@ -922,13 +1035,21 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) ! zero out stream data for this field ! ------------------------------------------ - call t_startf(trim(lstr)//trim(timname)//'_zero') + call ESMF_TraceRegionEnter(trim(lstr)//trim(timname)//'_zero') do nf = 1,size(sdat%pstrm(ns)%fldlist_model) - call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, sdat%pstrm(ns)%fldlist_model(nf), dataptr, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - dataptr(:) = 0._r8 + if (sdat%pstrm(ns)%stream_nlev > 1) then + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, & + sdat%pstrm(ns)%fldlist_model(nf), fldptr2=dataptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + dataptr2d(:,:) = 0._r8 + else + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, & + sdat%pstrm(ns)%fldlist_model(nf), fldptr1=dataptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + dataptr1d(:) = 0._r8 + end if end do - call t_stopf(trim(lstr)//trim(timname)//'_zero') + call ESMF_TraceRegionExit(trim(lstr)//trim(timname)//'_zero') endif @@ -939,8 +1060,7 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) endif ! nstreams > 0 - call t_stopf(trim(lstr)//trim(timname)//'_total') - if (.not.ltimers) call t_adj_detailf(-tadj) + call ESMF_TraceRegionExit(trim(lstr)//trim(timname)//'_total') end subroutine shr_strdata_advance @@ -1034,13 +1154,8 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) ! local variables type(shr_stream_streamType), pointer :: stream type(ESMF_Mesh) , pointer :: stream_mesh - type(ESMF_FieldBundle) , pointer :: fldbun_stream_lb - type(ESMF_FieldBundle) , pointer :: fldbun_stream_ub type(ESMF_VM) :: vm - integer :: nf - integer :: rCode ! return code logical :: fileexists - integer :: ivals(6) ! bcast buffer integer :: oDateLB,oSecLB,dDateLB integer :: oDateUB,oSecUB,dDateUB real(r8) :: rDateM,rDateLB,rDateUB ! model,LB,UB dates with fractional days @@ -1059,7 +1174,7 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) stream => sdat%stream(ns) stream_mesh => sdat%pstrm(ns)%stream_mesh - call t_startf(trim(istr)//'_setup') + call ESMF_TraceRegionEnter(trim(istr)//'_setup') ! allocate streamdat instance on all tasks call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -1081,15 +1196,15 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) rDateLB = real(sdat%pstrm(ns)%ymdLB,r8) + real(sdat%pstrm(ns)%todLB,r8)/shr_const_cday rDateUB = real(sdat%pstrm(ns)%ymdUB,r8) + real(sdat%pstrm(ns)%todUB,r8)/shr_const_cday - call t_stopf(trim(istr)//'_setup') + call ESMF_TraceRegionExit(trim(istr)//'_setup') ! if model current date is outside of model lower or upper bound - find the stream bounds if (rDateM < rDateLB .or. rDateM > rDateUB) then - call t_startf(trim(istr)//'_fbound') + call ESMF_TraceRegionEnter(trim(istr)//'_fbound') call shr_stream_findBounds(stream, mDate, mSec, & sdat%pstrm(ns)%ymdLB, dDateLB, sdat%pstrm(ns)%todLB, n_lb, filename_lb, & sdat%pstrm(ns)%ymdUB, dDateUB, sdat%pstrm(ns)%todUB, n_ub, filename_ub) - call t_stopf(trim(istr)//'_fbound') + call ESMF_TraceRegionExit(trim(istr)//'_fbound') endif ! determine if need to read in new stream data @@ -1102,10 +1217,8 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) sdat%pstrm(ns)%stream_lb = i else ! read lower bound of data - call shr_strdata_readstrm(sdat, ns, stream, stream_mesh, & - sdat%pstrm(ns)%fldlist_stream, sdat%pstrm(ns)%fldlist_model, & + call shr_strdata_readstrm(sdat, sdat%pstrm(ns), stream, & sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_lb), & - sdat%pio_subsystem, sdat%io_type, sdat%pstrm(ns)%stream_pio_iodesc_set, sdat%pstrm(ns)%stream_pio_iodesc, & filename_lb, n_lb, istr=trim(istr)//'_LB', boundstr='lb', rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return end if @@ -1113,16 +1226,14 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) if (sdat%pstrm(ns)%ymdUB /= oDateUB .or. sdat%pstrm(ns)%todUB /= oSecUB) then newdata = .true. - call shr_strdata_readstrm(sdat, ns, stream, stream_mesh, & - sdat%pstrm(ns)%fldlist_stream, sdat%pstrm(ns)%fldlist_model, & + call shr_strdata_readstrm(sdat, sdat%pstrm(ns), stream, & sdat%pstrm(ns)%fldbun_data(sdat%pstrm(ns)%stream_ub), & - sdat%pio_subsystem, sdat%io_type, sdat%pstrm(ns)%stream_pio_iodesc_set, sdat%pstrm(ns)%stream_pio_iodesc, & filename_ub, n_ub, istr=trim(istr)//'_UB', boundstr='ub', rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return endif ! determine previous & next data files in list of files - call t_startf(trim(istr)//'_filemgt') + call ESMF_TraceRegionEnter(trim(istr)//'_filemgt') if (sdat%masterproc .and. newdata) then call shr_stream_getPrevFileName(stream, filename_lb, filename_prev) call shr_stream_getNextFileName(stream, filename_ub, filename_next) @@ -1131,34 +1242,25 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) ! do nothing end if endif - call t_stopf(trim(istr)//'_filemgt') + call ESMF_TraceRegionExit(trim(istr)//'_filemgt') end subroutine shr_strdata_readLBUB !=============================================================================== - subroutine shr_strdata_readstrm(sdat, ns, stream, stream_mesh, & - fldlist_stream, fldlist_model, fldbun_model, & - pio_subsystem, pio_iotype, pio_iodesc_set, pio_iodesc, & + subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & filename, nt, istr, boundstr, rc) - use shr_const_mod , only : r8fill => SHR_CONST_SPVAL - use shr_infnan_mod , only : shr_infnan_isnan - ! Read the stream data and initialize the strea pio_iodesc the first time ! the stream is read + use shr_const_mod , only : r8fill => SHR_CONST_SPVAL + use shr_infnan_mod , only : shr_infnan_isnan + ! input/output variables type(shr_strdata_type) , intent(inout) :: sdat ! strdata data data-type - integer , intent(in) :: ns ! current stream index + type(shr_strdata_perstream) , intent(inout) :: per_stream type(shr_stream_streamType) , intent(inout) :: stream - type(ESMF_Mesh) , intent(in) :: stream_mesh - character(len=*) , intent(in) :: fldlist_stream(:) - character(len=*) , intent(in) :: fldlist_model(:) - type(ESMF_FieldBundle) , intent(inout) :: fldbun_model - type(iosystem_desc_t) , intent(inout), target :: pio_subsystem - integer , intent(in) :: pio_iotype - logical , intent(inout) :: pio_iodesc_set - type(io_desc_t) , intent(inout) :: pio_iodesc + type(ESMF_FieldBundle) , intent(inout) :: fldbun_data character(len=*) , intent(in) :: filename integer , intent(in) :: nt character(len=*) , intent(in) :: istr @@ -1166,6 +1268,7 @@ subroutine shr_strdata_readstrm(sdat, ns, stream, stream_mesh, & integer , intent(out) :: rc ! local variables + integer :: stream_nlev type(ESMF_Field) :: field_dst, vector_dst character(CL) :: currfile logical :: fileexists @@ -1174,23 +1277,33 @@ subroutine shr_strdata_readstrm(sdat, ns, stream, stream_mesh, & type(var_desc_t) :: varid integer :: nf integer :: rCode - real(r4), allocatable :: data_real(:) real(r4) :: fillvalue_r4 real(r8) :: fillvalue_r8 logical :: handlefill = .false. integer :: old_error_handle - real(r8), pointer :: dataptr(:)=>null() - real(r8), pointer :: dataptr2d_src(:,:) => null(), dataptr2d_dst(:,:) => null() + real(r8), pointer :: dataptr(:) => null() + real(r8), pointer :: dataptr1d(:) => null() ! field bundle data + real(r8), pointer :: dataptr2d(:,:) => null() ! field bundle data + real(r8), pointer :: dataptr2d_src(:,:) => null() ! field bundle data + real(r8), pointer :: dataptr2d_dst(:,:) => null() ! field bundle data + real(r4), allocatable :: data_real1d(:) ! stream input data + real(r4), allocatable :: data_real2d(:,:) ! stream input data + real(r8), allocatable :: data_dbl1d(:) ! stream input data + real(r8), allocatable :: data_dbl2d(:,:) ! stream input data + integer(i2), allocatable :: data_short1d(:) ! stream input data + integer(i2), allocatable :: data_short2d(:,:) ! stream input data integer :: lsize, n integer :: spatialDim, numOwnedElements integer :: pio_iovartype - real(r8), pointer :: nv_coords(:), nu_coords(:), data_u_dst(:), data_v_dst(:) - real(r8) :: lat, lon, sinlat, sinlon, coslat, coslon + real(r8), pointer :: nv_coords(:), nu_coords(:) + real(r8), pointer :: data_u_dst(:), data_v_dst(:) + real(r8) :: lat, lon + real(r8) :: sinlat, sinlon + real(r8) :: coslat, coslon real(r8) :: scale_factor, add_offset - integer(i2), allocatable :: data_short(:) integer(i2) :: fillvalue_i2 character(CS) :: uname, vname - integer :: i + integer :: i, lev logical :: checkflag = .false. character(*), parameter :: subname = '(shr_strdata_readstrm) ' character(*), parameter :: F00 = "('(shr_strdata_readstrm) ',8a)" @@ -1220,7 +1333,7 @@ subroutine shr_strdata_readstrm(sdat, ns, stream, stream_mesh, & call pio_closefile(pioid) endif if (sdat%masterproc) write(sdat%logunit,F00) 'opening : ',trim(filename) - rcode = pio_openfile(pio_subsystem, pioid, pio_iotype, trim(filename), pio_nowrite) + rcode = pio_openfile(sdat%pio_subsystem, pioid, sdat%io_type, trim(filename), pio_nowrite) call shr_stream_setCurrFile(stream, fileopen=.true., currfile=trim(filename), currpioid=pioid) endif @@ -1228,50 +1341,77 @@ subroutine shr_strdata_readstrm(sdat, ns, stream, stream_mesh, & ! Determine the pio io descriptor for the stream from the first data field in the stream ! ****************************************************************************** - if (ESMF_MeshIsCreated(stream_mesh)) then - if(.not. pio_iodesc_set) then - call shr_strdata_set_stream_iodesc(sdat, pio_subsystem, pioid, & - trim(fldlist_stream(1)), stream_mesh, pio_iodesc, rc=rc) + stream_nlev = per_stream%stream_nlev + + if (ESMF_MeshIsCreated(per_stream%stream_mesh)) then + if (.not. per_stream%stream_pio_iodesc_set) then + call shr_strdata_set_stream_iodesc(sdat, per_stream, trim(per_stream%fldlist_stream(1)), & + pioid, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - pio_iodesc_set = .true. + per_stream%stream_pio_iodesc_set = .true. endif - call dshr_field_getfldptr(sdat%pstrm(ns)%field_stream, fldptr1=dataptr, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return + if (stream_nlev > 1) then + call dshr_field_getfldptr(per_stream%field_stream, fldptr2=dataptr2d, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + else + call dshr_field_getfldptr(per_stream%field_stream, fldptr1=dataptr1d, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + end if else - allocate(dataptr(1)) + if (stream_nlev == 1) then + allocate(dataptr1d(1)) + else + call shr_sys_abort("ERROR: multi-level streams always require a stream mesh") + end if end if ! ****************************************************************************** ! Read in the stream data for field names in fldname_stream_input - but fill in ! the data for fldbun_stream with the field names fldname_stream_model + ! Note that the dimensions in the field bundle field are (stream_nlev,i) whereas + ! the dimension of the input data are (i,stream_nlev) ! ****************************************************************************** - call t_startf(trim(istr)//'_readpio') + call ESMF_TraceRegionEnter(trim(istr)//'_readpio') if (sdat%masterproc) then write(sdat%logunit,F02) 'file ' // trim(boundstr) //': ',trim(filename), nt endif - if(sdat%pstrm(ns)%ucomp > 0 .and. sdat%pstrm(ns)%vcomp > 0) then + if(per_stream%ucomp > 0 .and. per_stream%vcomp > 0) then call shr_string_listGetName(stream%stream_vectors,1,uname) call shr_string_listGetName(stream%stream_vectors,2,vname) - call dshr_field_getfldptr(sdat%pstrm(ns)%stream_vector, fldptr2=dataptr2d_src, rc=rc) + call dshr_field_getfldptr(per_stream%stream_vector, fldptr2=dataptr2d_src, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return endif - lsize = size(dataptr) - do nf = 1,size(fldlist_stream) - call dshr_fldbun_getfieldN(fldbun_model, nf, field_dst, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - rcode = pio_inq_varid(pioid, trim(fldlist_stream(nf)), varid) + do nf = 1,size(per_stream%fldlist_stream) + ! determine type of the variable + rcode = pio_inq_varid(pioid, trim(per_stream%fldlist_stream(nf)), varid) rcode = pio_inq_vartype(pioid, varid, pio_iovartype) - if (pio_iovartype == PIO_REAL .and. .not. allocated(data_real)) then - allocate(data_real(lsize)) - else if(pio_iovartype == PIO_SHORT .and. .not. allocated(data_short)) then - allocate(data_short(lsize)) - endif + ! allocate memory for input read + if (stream_nlev > 1) then + lsize = size(dataptr2d, dim=2) + if (pio_iovartype == PIO_REAL .and. .not. allocated(data_real2d)) then + allocate(data_real2d(lsize, stream_nlev)) + else if (pio_iovartype == PIO_DOUBLE .and. .not. allocated(data_dbl2d)) then + allocate(data_dbl2d(lsize, stream_nlev)) + else if(pio_iovartype == PIO_SHORT .and. .not. allocated(data_short2d)) then + allocate(data_short2d(lsize, stream_nlev)) + endif + else + lsize = size(dataptr1d) + if (pio_iovartype == PIO_REAL .and. .not. allocated(data_real1d)) then + allocate(data_real1d(lsize)) + else if (pio_iovartype == PIO_DOUBLE .and. .not. allocated(data_dbl1d)) then + allocate(data_dbl1d(lsize)) + else if(pio_iovartype == PIO_SHORT .and. .not. allocated(data_short1d)) then + allocate(data_short1d(lsize)) + endif + end if + ! determine if will handle fill handlefill = .false. call PIO_seterrorhandling(pioid, PIO_BCAST_ERROR, old_error_handle) if (pio_iovartype == PIO_REAL) then @@ -1281,11 +1421,11 @@ subroutine shr_strdata_readstrm(sdat, ns, stream, stream_mesh, & else if (pio_iovartype == PIO_SHORT) then rcode = pio_get_att(pioid, varid, "scale_factor", scale_factor) if(rcode /= PIO_NOERR) then - call shr_sys_abort('DATATYPE PIO_SHORT requires attributes scale_factor and add_offset') + call shr_sys_abort('DATATYPE PIO_SHORT requires attributes scale_factor') endif rcode = pio_get_att(pioid, varid, "add_offset", add_offset) if(rcode /= PIO_NOERR) then - call shr_sys_abort('DATATYPE PIO_SHORT requires attributes scale_factor and add_offset') + call shr_sys_abort('DATATYPE PIO_SHORT requires attributes add_offset') endif rcode = pio_get_att(pioid, varid, "_FillValue", fillvalue_i2) endif @@ -1293,104 +1433,218 @@ subroutine shr_strdata_readstrm(sdat, ns, stream, stream_mesh, & call PIO_seterrorhandling(pioid, old_error_handle) if (debug>0 .and. sdat%masterproc) then - write(sdat%logunit,F02)' reading '//trim(fldlist_stream(nf))//' into '//trim(fldlist_model(nf)),& + write(sdat%logunit,F02)' reading '//& + trim(per_stream%fldlist_stream(nf))//' into '//trim(per_stream%fldlist_model(nf)),& ' at time index: ',nt end if + ! read the data call pio_setframe(pioid, varid, int(nt,kind=Pio_Offset_Kind)) if (pio_iovartype == PIO_REAL) then - if (pio_iodesc_set) then - call pio_read_darray(pioid, varid, pio_iodesc, data_real, rcode) - else - rcode = pio_get_var(pioid, varid,start=(/1,1,nt/),count=(/1,1,1/), ival=data_real) - endif - if ( rcode /= PIO_NOERR ) then - call shr_sys_abort(' ERROR: reading in variable: '// trim(fldlist_stream(nf))) + ! ----------------------------- + ! pio_iovartype is PIO_REAL + ! ----------------------------- + if (stream_nlev > 1) then + if (per_stream%stream_pio_iodesc_set) then + call pio_read_darray(pioid, varid, per_stream%stream_pio_iodesc, data_real2d, rcode) + else + rcode = pio_get_var(pioid, varid,start=(/1,1,1,nt/),count=(/1,1,1,1/), ival=data_real2d) + end if + if ( rcode /= PIO_NOERR ) then + call shr_sys_abort(' ERROR: reading in variable: '// trim(per_stream%fldlist_stream(nf))) + end if + if (handlefill) then + do lev = 1,stream_nlev + do n = 1,size(dataptr2d, dim=2) + if (.not. shr_infnan_isnan(data_real2d(n,lev)) .and. data_real2d(n,lev) .ne. fillvalue_r4) then + dataptr2d(lev,n) = real(data_real2d(n,lev), kind=r8) ! Note the order of indices + else + dataptr2d(lev,n) = r8fill + endif + enddo + end do + else + do lev = 1,stream_nlev + do n = 1,size(dataptr2d, dim=2) + dataptr2d(lev,n) = real(data_real2d(n,lev), kind=r8) + end do + end do + end if + else ! stream_nlev == 1 + if (per_stream%stream_pio_iodesc_set) then + call pio_read_darray(pioid, varid, per_stream%stream_pio_iodesc, data_real1d, rcode) + else + rcode = pio_get_var(pioid, varid,start=(/1,1,nt/),count=(/1,1,1/), ival=data_real1d) + endif + if ( rcode /= PIO_NOERR ) then + call shr_sys_abort(' ERROR: reading in variable: '// trim(per_stream%fldlist_stream(nf))) + end if + if (handlefill) then + do n=1,size(dataptr1d) + if(.not. shr_infnan_isnan(data_real1d(n)) .and. data_real1d(n) .ne. fillvalue_r4) then + dataptr1d(n) = real(data_real1d(n), kind=r8) + else + dataptr1d(n) = r8fill + endif + enddo + else + dataptr1d(:) = real(data_real1d(:),kind=r8) + endif end if - if(handlefill) then - do n=1,size(dataptr) - if(.not. shr_infnan_isnan(data_real(n)) .and. data_real(n) .ne. fillvalue_r4) then - dataptr(n) = real(data_real(n), kind=r8) - else - dataptr(n) = r8fill - endif - enddo - else - dataptr(:) = real(data_real(:),kind=r8) - endif + else if (pio_iovartype == PIO_DOUBLE) then - if (pio_iodesc_set) then - call pio_read_darray(pioid, varid, pio_iodesc, dataptr, rcode) - else - rcode = pio_get_var(pioid, varid,start=(/1,1,nt/),count=(/1,1,1/), ival=dataptr) - endif - if ( rcode /= PIO_NOERR ) then - call shr_sys_abort(' ERROR: reading in variable: '// trim(fldlist_stream(nf))) + ! ----------------------------- + ! pio_iovartype is PIO_DOUBLE + ! ----------------------------- + if (stream_nlev > 1) then + if (per_stream%stream_pio_iodesc_set) then + call pio_read_darray(pioid, varid, per_stream%stream_pio_iodesc, data_dbl2d, rcode) + else + rcode = pio_get_var(pioid, varid,start=(/1,1,1,nt/), count=(/1,1,1,1/), ival=data_dbl2d) + end if + if ( rcode /= PIO_NOERR ) then + call shr_sys_abort(' ERROR: reading in 2d double variable: '// trim(per_stream%fldlist_stream(nf))) + end if + if (handlefill) then + do lev = 1,stream_nlev + do n = 1,size(dataptr2d, dim=2) + if (.not. shr_infnan_isnan(data_dbl2d(n,lev)) .and. data_dbl2d(n,lev) .ne. fillvalue_r8) then + dataptr2d(lev,n) = data_dbl2d(n,lev) + else + dataptr2d(lev,n) = r8fill + endif + enddo + end do + else + do lev = 1,stream_nlev + do n = 1,size(dataptr2d, dim=2) + dataptr2d(lev,n) = data_dbl2d(n,lev) + end do + end do + end if + else ! stream_nlev == 1 + if (per_stream%stream_pio_iodesc_set) then + call pio_read_darray(pioid, varid, per_stream%stream_pio_iodesc, data_dbl1d, rcode) + else + rcode = pio_get_var(pioid, varid,start=(/1,1,nt/), count=(/1,1,1/), ival=data_dbl1d) + endif + if ( rcode /= PIO_NOERR ) then + call shr_sys_abort(' ERROR: reading in variable: '// trim(per_stream%fldlist_stream(nf))) + end if + if (handlefill) then + do n = 1,size(dataptr1d) + if (.not. shr_infnan_isnan(data_dbl1d(n)) .and. data_dbl1d(n) .ne. fillvalue_r8) then + dataptr1d(n) = data_dbl1d(n) + else + dataptr1d(n) = r8fill + end if + enddo + else + do n = 1,size(dataptr1d) + dataptr1d(n) = data_dbl1d(n) + end do + endif end if - if(handlefill) then - do n=1,size(dataptr) - if(.not. shr_infnan_isnan(dataptr(n)) .and. dataptr(n).eq.fillvalue_r8) then - dataptr(n) = r8fill - endif - enddo - endif + elseif (pio_iovartype == PIO_SHORT) then - if (pio_iodesc_set) then - call pio_read_darray(pioid, varid, pio_iodesc, data_short, rcode) - else - rcode = pio_get_var(pioid, varid,start=(/1,1,nt/),count=(/1,1,1/), ival=data_short) - endif - if ( rcode /= PIO_NOERR ) then - call shr_sys_abort(' ERROR: reading in variable: '// trim(fldlist_stream(nf))) + ! ----------------------------- + ! pio_iovartype is PIO_SHORT + ! ----------------------------- + if (stream_nlev > 1) then + if (per_stream%stream_pio_iodesc_set) then + call pio_read_darray(pioid, varid, per_stream%stream_pio_iodesc, data_short2d, rcode) + else + rcode = pio_get_var(pioid, varid,start=(/1,1,1,nt/), count=(/1,1,1,1/), ival=data_short2d) + end if + if ( rcode /= PIO_NOERR ) then + call shr_sys_abort(' ERROR: reading in 2d short variable: '// trim(per_stream%fldlist_stream(nf))) + end if + if (handlefill) then + do lev = 1,stream_nlev + do n = 1,lsize + if(data_short2d(n,lev) .eq. fillvalue_i2) then + dataptr2d(lev,n) = r8fill + else + dataptr2d(lev,n) = real(data_short2d(lev,n),r8) * scale_factor + add_offset + endif + enddo + end do + else + do lev = 1,stream_nlev + do n = 1,lsize + dataptr2d(lev,n) = real(data_short2d(n,lev),r8) * scale_factor + add_offset + enddo + end do + end if + else ! stream_nlev == 1 + if (per_stream%stream_pio_iodesc_set) then + call pio_read_darray(pioid, varid, per_stream%stream_pio_iodesc, data_short1d, rcode) + else + rcode = pio_get_var(pioid, varid,start=(/1,1,nt/),count=(/1,1,1/), ival=data_short1d) + endif + if ( rcode /= PIO_NOERR ) then + call shr_sys_abort(' ERROR: reading in variable: '// trim(per_stream%fldlist_stream(nf))) + end if + if (handlefill) then + do n=1,lsize + if(data_short1d(n).eq.fillvalue_i2) then + dataptr1d(n) = r8fill + else + dataptr1d(n) = real(data_short1d(n),r8) * scale_factor + add_offset + endif + enddo + else + do n=1,lsize + dataptr1d(n) = real(data_short1d(n),r8) * scale_factor + add_offset + enddo + endif end if - if(handlefill) then - do n=1,lsize - if(data_short(n).eq.fillvalue_i2) then - dataptr(n) = r8fill - else - dataptr(n) = real(data_short(n),r8) * scale_factor + add_offset - endif - enddo - else - do n=1,lsize - dataptr(n) = real(data_short(n),r8) * scale_factor + add_offset - enddo - endif + else + ! ----------------------------- + ! pio_iovartype is not supported + ! ----------------------------- call shr_sys_abort(subName//"ERROR: only double, real and short types are supported for stream read") + end if - if(associated(dataptr2d_src) .and. trim(fldlist_model(nf)) .eq. uname) then + if(associated(dataptr2d_src) .and. trim(per_stream%fldlist_model(nf)) .eq. uname) then ! save in dataptr2d_src - dataptr2d_src(1,:) = dataptr(:) - elseif(associated(dataptr2d_src) .and. trim(fldlist_model(nf)) .eq. vname) then - dataptr2d_src(2,:) = dataptr(:) - else if (pio_iodesc_set) then - call ESMF_FieldRegrid(sdat%pstrm(ns)%field_stream, field_dst, routehandle=sdat%pstrm(ns)%routehandle, & + dataptr2d_src(1,:) = dataptr1d(:) + elseif(associated(dataptr2d_src) .and. trim(per_stream%fldlist_model(nf)) .eq. vname) then + dataptr2d_src(2,:) = dataptr1d(:) + else if (per_stream%stream_pio_iodesc_set) then + ! Regrid the field_stream read in to the model mesh + call dshr_fldbun_getfieldN(fldbun_data, nf, field_dst, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldRegrid(per_stream%field_stream, field_dst, routehandle=per_stream%routehandle, & termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=.false., zeroregion=ESMF_REGION_TOTAL, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return else - call ESMF_FieldFill(field_dst, dataFillScheme="const", const1=dataptr(1), rc=rc) + call dshr_fldbun_getfieldN(fldbun_data, nf, field_dst, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldFill(field_dst, dataFillScheme="const", const1=dataptr1d(1), rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return endif enddo ! Both components of a vector stream must be in the same input stream file - if(associated(dataptr2d_src)) then + if (associated(dataptr2d_src) .and. associated(dataptr1d)) then ! get lon and lat of stream u and v fields + lsize = size(dataptr1d) allocate(dataptr(lsize)) - call ESMF_MeshGet(sdat%pstrm(ns)%stream_mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) + call ESMF_MeshGet(per_stream%stream_mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return allocate(nu_coords(spatialDim*numOwnedElements)) - call ESMF_MeshGet(sdat%pstrm(ns)%stream_mesh, ownedElemCoords=nu_coords) + call ESMF_MeshGet(per_stream%stream_mesh, ownedElemCoords=nu_coords) if (chkerr(rc,__LINE__,u_FILE_u)) return allocate(nv_coords(spatialDim*numOwnedElements)) - call ESMF_MeshGet(sdat%pstrm(ns)%stream_mesh, ownedElemCoords=nv_coords) + call ESMF_MeshGet(per_stream%stream_mesh, ownedElemCoords=nv_coords) if (chkerr(rc,__LINE__,u_FILE_u)) return do i=1,lsize @@ -1406,15 +1660,15 @@ subroutine shr_strdata_readstrm(sdat, ns, stream, stream_mesh, & ungriddedLbound=(/1/), ungriddedUbound=(/2/), gridToFieldMap=(/2/), meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldRegrid(sdat%pstrm(ns)%stream_vector, vector_dst, sdat%pstrm(ns)%routehandle, & + call ESMF_FieldRegrid(per_stream%stream_vector, vector_dst, per_stream%routehandle, & termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=checkflag, zeroregion=ESMF_REGION_TOTAL, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldGet(vector_dst, farrayPtr=dataptr2d_dst, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_fldbun_getFldPtr(fldbun_model, trim(uname), data_u_dst, rc=rc) + call dshr_fldbun_getFldPtr(fldbun_data, trim(uname), data_u_dst, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_fldbun_getFldPtr(fldbun_model, trim(vname), data_v_dst, rc=rc) + call dshr_fldbun_getFldPtr(fldbun_data, trim(vname), data_v_dst, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return do i = 1,size(data_u_dst) @@ -1425,118 +1679,160 @@ subroutine shr_strdata_readstrm(sdat, ns, stream, stream_mesh, & data_u_dst(i) = coslon * dataptr2d_dst(1,i) + sinlon * dataptr2d_dst(2,i) data_v_dst(i) = -sinlon * dataptr2d_dst(1,i) + coslon * dataptr2d_dst(2,i) enddo + + deallocate(dataptr) endif if (pio_iovartype == PIO_REAL) then - deallocate(data_real) + if (allocated(data_real1d)) deallocate(data_real1d) + if (allocated(data_real2d)) deallocate(data_real2d) + else if (pio_iovartype == PIO_DOUBLE) then + if (allocated(data_dbl1d)) deallocate(data_dbl1d) + if (allocated(data_dbl2d)) deallocate(data_dbl2d) + else if (pio_iovartype == PIO_SHORT) then + if (allocated(data_short1d)) deallocate(data_short1d) + if (allocated(data_short2d)) deallocate(data_short2d) endif - if(.not. pio_iodesc_set) then - deallocate(dataptr) + if (.not. per_stream%stream_pio_iodesc_set) then + deallocate(dataptr1d) endif - call t_stopf(trim(istr)//'_readpio') + call ESMF_TraceRegionExit(trim(istr)//'_readpio') end subroutine shr_strdata_readstrm !=============================================================================== - subroutine shr_strdata_set_stream_iodesc(sdat, & - pio_subsystem, pioid, fldname, stream_mesh, pio_iodesc, rc) + subroutine shr_strdata_set_stream_iodesc(sdat, per_stream, fldname, pioid, rc) + + ! Set stream_pio_iodesc and stream_pio_iodesc_set in stream ! input/output variables - type(shr_strdata_type) , intent(in) :: sdat - type(iosystem_desc_t) , intent(inout), target :: pio_subsystem - type(file_desc_t) , intent(inout) :: pioid - character(len=*) , intent(in) :: fldname - type(ESMF_Mesh) , intent(in) :: stream_mesh - type(io_desc_t) , intent(inout) :: pio_iodesc - integer , intent(out) :: rc + type(shr_strdata_type) , intent(in) :: sdat ! strdata data data-type + type(shr_strdata_perstream) , intent(inout) :: per_stream + character(len=*) , intent(in) :: fldname + type(file_desc_t) , intent(inout) :: pioid + integer , intent(out) :: rc ! local variables - integer :: pio_iovartype - integer :: n - type(var_desc_t) :: varid - integer :: ndims - integer, allocatable :: dimids(:) - integer, allocatable :: dimlens(:) - integer :: unlimdid - type(ESMF_DistGrid) :: distGrid - integer :: lsize - integer, pointer :: compdof(:) => null() - character(CS) :: dimname - integer :: rCode ! pio return code (only used when pio error handling is PIO_BCAST_ERROR) - character(*), parameter :: subname = '(shr_strdata_set_stream_iodesc) ' - character(*), parameter :: F00 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,a)" - character(*), parameter :: F01 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,a)" - character(*), parameter :: F02 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,i8,2x,a)" + + integer :: stream_nlev + integer :: gsize2d + integer :: pio_iovartype + integer :: n, m, cnt + type(var_desc_t) :: varid + integer :: ndims + character(CS) :: dimname + integer, allocatable :: dimids(:) + integer, allocatable :: dimlens(:) + type(ESMF_DistGrid) :: distGrid + integer :: lsize + integer, pointer :: compdof(:) => null() + integer, pointer :: compdof3d(:) => null() + integer :: rCode ! pio return code (only used when pio error handling is PIO_BCAST_ERROR) + character(*), parameter :: subname = '(shr_strdata_set_stream_iodesc) ' + character(*), parameter :: F00 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,a)" + character(*), parameter :: F01 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,a)" + character(*), parameter :: F02 = "('(shr_strdata_set_stream_iodesc) ',a,i8,2x,i8,2x,i8,2x,a)" !------------------------------------------------------------------------------- - integer :: old_error_handle rc = ESMF_SUCCESS -! call pio_seterrorhandling(pioid, PIO_BCAST_ERROR, old_error_handle) + ! set the number of vertical levels to a local variable + stream_nlev = per_stream%stream_nlev - ! query the first field in the stream dataset + ! query the variable fldname in the stream dataset for its dimensions rcode = pio_inq_varid(pioid, trim(fldname), varid) rcode = pio_inq_varndims(pioid, varid, ndims) + ! allocate memory for dimids and dimlens allocate(dimids(ndims)) allocate(dimlens(ndims)) - rcode = pio_inq_vardimid(pioid, varid, dimids(1:ndims)) - do n = 1, ndims rcode = pio_inq_dimlen(pioid, dimids(n), dimlens(n)) end do ! determine compdof for stream - call ESMF_MeshGet(stream_mesh, elementdistGrid=distGrid, rc=rc) + call ESMF_MeshGet(per_stream%stream_mesh, elementdistGrid=distGrid, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_DistGridGet(distGrid, localDe=0, elementCount=lsize, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return allocate(compdof(lsize)) call ESMF_DistGridGet(distGrid, localDe=0, seqIndexList=compdof, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (stream_nlev > 1) then + allocate(compdof3d(stream_nlev*lsize)) + ! Assume that first 2 dimensions correspond to the compdof + gsize2d = dimlens(1)*dimlens(2) + cnt = 0 + do n = 1,stream_nlev + do m = 1,size(compdof) + cnt = cnt + 1 + compdof3d(cnt) = (n-1)*gsize2d + compdof(m) + enddo + enddo + end if ! determine type of the variable rcode = pio_inq_vartype(pioid, varid, pio_iovartype) + ! determine io descriptor if (ndims == 2) then if (sdat%masterproc) then write(sdat%logunit,F00) 'setting iodesc for : '//trim(fldname)// & ' with dimlens(1), dimlens2 = ',dimlens(1),dimlens(2),& - ' variable had no time dimension ' + ' variable has no time dimension ' end if - call pio_initdecomp(pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof, pio_iodesc) + call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof, & + per_stream%stream_pio_iodesc) + else if (ndims == 3) then rcode = pio_inq_dimname(pioid, dimids(ndims), dimname) - if (trim(dimname) == 'time' .or. trim(dimname) == 'nt') then + if (stream_nlev > 1) then + write(sdat%logunit,F01) 'setting iodesc for : '//trim(fldname)// & + ' with dimlens(1), dimlens(2), dimlens(3) = ',dimlens(1),dimlens(2), dimlens(3), & + ' variable has no time dimension '//trim(dimname) + call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2),dimlens(3)/), compdof3d, & + per_stream%stream_pio_iodesc) + else if (trim(dimname) == 'time' .or. trim(dimname) == 'nt') then if (sdat%masterproc) then write(sdat%logunit,F01) 'setting iodesc for : '//trim(fldname)// & ' with dimlens(1), dimlens(2) = ',dimlens(1),dimlens(2),& - ' variable had time dimension '//trim(dimname) + ' variable as time dimension '//trim(dimname) end if - call pio_initdecomp(pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof, pio_iodesc) - else + call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2)/), compdof, & + per_stream%stream_pio_iodesc) + end if + + else if (ndims == 4) then + rcode = pio_inq_dimname(pioid, dimids(ndims), dimname) + if (stream_nlev > 1 .and. (trim(dimname) == 'time' .or. trim(dimname) == 'nt')) then if (sdat%masterproc) then write(sdat%logunit,F02) 'setting iodesc for : '//trim(fldname)// & ' with dimlens(1), dimlens(2),dimlens(3) = ',dimlens(1),dimlens(2),dimlens(3),& - ' variable had no time dimension ' + ' variable has time dimension ' end if - call pio_initdecomp(pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2),dimlens(3)/), compdof, pio_iodesc) + call pio_initdecomp(sdat%pio_subsystem, pio_iovartype, (/dimlens(1),dimlens(2),dimlens(3)/), compdof3d, & + per_stream%stream_pio_iodesc) + else + write(6,*)'ERROR: dimlens= ',dimlens + call shr_sys_abort(trim(subname)//' dimlens = 4 assumes a time dimension') end if + else write(6,*)'ERROR: dimlens= ',dimlens - call shr_sys_abort(trim(subname)//' only ndims of 2 and 3 are currently supported') + call shr_sys_abort(trim(subname)//' only ndims of 2 and 3 and 4 are currently supported') end if -! call pio_seterrorhandling(pioid, old_error_handle) + ! deallocate memory deallocate(compdof) + if (associated(compdof3d)) deallocate(compdof3d) deallocate(dimids) deallocate(dimlens) end subroutine shr_strdata_set_stream_iodesc !=============================================================================== - subroutine shr_strdata_get_stream_pointer(sdat, strm_fld, strm_ptr, rc) + subroutine shr_strdata_get_stream_pointer_1d(sdat, strm_fld, strm_ptr, rc) ! Set a pointer, strm_ptr, for field, strm_fld, into sdat fldbun_model field bundle @@ -1549,8 +1845,8 @@ subroutine shr_strdata_get_stream_pointer(sdat, strm_fld, strm_ptr, rc) ! local variables integer :: ns, nf logical :: found - character(len=*), parameter :: subname='(shr_strdata_get_stream_pointer)' - character(*) , parameter :: F00 = "('(shr_strdata_get_stream_pointer) ',8a)" + character(len=*), parameter :: subname='(shr_strdata_get_stream_pointer_1d)' + character(*) , parameter :: F00 = "('(shr_strdata_get_stream_pointer_1d) ',8a)" ! ---------------------------------------------- rc = ESMF_SUCCESS @@ -1562,7 +1858,7 @@ subroutine shr_strdata_get_stream_pointer(sdat, strm_fld, strm_ptr, rc) do nf = 1,size(sdat%pstrm(ns)%fldlist_model) if (trim(strm_fld) == trim(sdat%pstrm(ns)%fldlist_model(nf))) then call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, trim(sdat%pstrm(ns)%fldlist_model(nf)), & - strm_ptr, rc=rc) + fldptr1=strm_ptr, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return if (sdat%masterproc) then write(sdat%logunit,F00)' strm_ptr is allocated for stream field strm_'//trim(strm_fld) @@ -1573,25 +1869,46 @@ subroutine shr_strdata_get_stream_pointer(sdat, strm_fld, strm_ptr, rc) end do if (found) exit end do - - end subroutine shr_strdata_get_stream_pointer + end subroutine shr_strdata_get_stream_pointer_1d !=============================================================================== - subroutine shr_strdata_handle_error(ierr, errorstr) - use pio, only: pio_noerr + subroutine shr_strdata_get_stream_pointer_2d(sdat, strm_fld, strm_ptr, rc) + + ! Set a pointer, strm_ptr, for field, strm_fld, into sdat fldbun_model field bundle ! input/output variables - integer, intent(in) :: ierr - character(len=*), intent(in) :: errorstr + type(shr_strdata_type) , intent(in) :: sdat + character(len=*) , intent(in) :: strm_fld + real(r8) , pointer :: strm_ptr(:,:) + integer , intent(out) :: rc ! local variables - character(len=256) :: errormsg - !------------------------------------------------------------------------------- + integer :: ns, nf + logical :: found + character(len=*), parameter :: subname='(shr_strdata_get_stream_pointer_2d)' + character(*) , parameter :: F00 = "('(shr_strdata_get_stream_pointer_2d) ',8a)" + ! ---------------------------------------------- - if (ierr /= PIO_NOERR) then - write(errormsg, '(a,i6,2a)') '(PIO:', ierr, ') ', trim(errorstr) - call shr_sys_abort(errormsg) - end if - end subroutine shr_strdata_handle_error + rc = ESMF_SUCCESS + + ! loop over all input streams and determine if the strm_fld is in the field bundle of the target stream + do ns = 1, shr_strdata_get_stream_count(sdat) + found = .false. + ! Check if requested stream field is read in - and if it is then point into the stream field bundle + do nf = 1,size(sdat%pstrm(ns)%fldlist_model) + if (trim(strm_fld) == trim(sdat%pstrm(ns)%fldlist_model(nf))) then + call dshr_fldbun_getfldptr(sdat%pstrm(ns)%fldbun_model, trim(sdat%pstrm(ns)%fldlist_model(nf)), & + fldptr2=strm_ptr, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (sdat%masterproc) then + write(sdat%logunit,F00)' strm_ptr is allocated for stream field strm_'//trim(strm_fld) + end if + found = .true. + exit + end if + end do + if (found) exit + end do + end subroutine shr_strdata_get_stream_pointer_2d end module dshr_strdata_mod diff --git a/streams/dshr_stream_mod.F90 b/streams/dshr_stream_mod.F90 index 5f1975eb1..0a4da07cc 100644 --- a/streams/dshr_stream_mod.F90 +++ b/streams/dshr_stream_mod.F90 @@ -86,6 +86,7 @@ module dshr_stream_mod integer :: yearFirst = -1 ! first year to use in t-axis (yyyymmdd) integer :: yearLast = -1 ! last year to use in t-axis (yyyymmdd) integer :: yearAlign = -1 ! align yearFirst with this model year + character(CS) :: lev_dimname = 'null' ! name of vertical dimension if any character(CS) :: taxMode = shr_stream_taxis_cycle ! cycling option for time axis character(CS) :: tInterpAlgo = 'linear' ! algorithm to use for time interpolation character(CS) :: mapalgo = 'bilinear' ! type of mapping - default is 'bilinear' @@ -110,7 +111,7 @@ module dshr_stream_mod end type shr_stream_streamType !----- parameters ----- - integer , save :: debug = 0 ! edit/turn-on for debug write statements + integer :: debug = 0 ! edit/turn-on for debug write statements real(R8) , parameter :: spd = shr_const_cday ! seconds per day character(*) , parameter :: u_FILE_u = & __FILE__ @@ -129,19 +130,24 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, ! ! ! - ! - ! mesh_filename - ! - ! - ! /glade/p/cesmdata/cseg/inputdata/atm/datm7/NYF/nyf.ncep.T62.050923.nc - ! ..... - ! - ! - ! u_10 u - ! - ! - ! 0 - ! + ! + ! + ! + ! + ! + ! + ! + ! + ! + ! + ! + ! + ! + ! + ! + ! + ! + ! ! ! ! --------------------------------------------------------------------- @@ -163,6 +169,7 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, integer :: status integer :: tmp(6) real(r8) :: rtmp(1) + character(*),parameter :: subName = '(shr_stream_init_from_xml) ' ! -------------------------------------------------------- rc = ESMF_SUCCESS @@ -173,7 +180,7 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, Sdoc => parseFile(xmlfilename, iostat=status) if (status /= 0) then - call shr_sys_abort("Could not open file "//trim(xmlfilename)) + call shr_sys_abort("Could not parse file "//trim(xmlfilename)) endif streamlist => getElementsByTagname(Sdoc, "stream_info") nstrms = getLength(streamlist) @@ -241,6 +248,13 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, call shr_sys_abort("stream vectors must be provided") endif + p => item(getElementsByTagname(streamnode, "stream_lev_dimname"), 0) + if (associated(p)) then + call extractDataContent(p, streamdat(i)%lev_dimname) + else + call shr_sys_abort("stream vertical level dimension name must be provided") + endif + p => item(getElementsByTagname(streamnode, "stream_data_files"), 0) if (.not. associated(p)) then call shr_sys_abort("stream data files must be provided") @@ -313,6 +327,8 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, enddo call ESMF_VMBroadCast(vm, streamdat(i)%meshfile, CL, 0, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_VMBroadCast(vm, streamdat(i)%lev_dimname, CS, 0, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_VMBroadCast(vm, streamdat(i)%taxmode, CS, 0, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_VMBroadCast(vm, streamdat(i)%readmode, CS, 0, rc=rc) @@ -332,8 +348,12 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, streamdat(i)%pio_iotype = shr_pio_getiotype(trim(compname)) streamdat(i)%pio_ioformat = shr_pio_getioformat(trim(compname)) call shr_stream_getCalendar(streamdat(i), 1, streamdat(i)%calendar) - enddo + ! Error check + if (trim(streamdat(i)%taxmode) == shr_stream_taxis_extend .and. streamdat(i)%dtlimit < 1.e10) then + call shr_sys_abort(trim(subName)//" ERROR: if taxmode value is extend set dtlimit to 1.e30") + end if + enddo ! Set logunit streamdat(:)%logunit = logunit @@ -341,14 +361,16 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, ! initialize flag that stream has been set streamdat(:)%init = .true. - end subroutine shr_stream_init_from_xml !=============================================================================== - subroutine shr_stream_init_from_inline(streamdat, stream_meshfile, stream_mapalgo, & - stream_yearFirst, stream_yearLast, stream_yearAlign, stream_offset, stream_taxmode, & - stream_fldlistFile, stream_fldListModel, stream_fileNames, logunit, compname) + subroutine shr_stream_init_from_inline(streamdat, & + stream_meshfile, stream_lev_dimname, stream_mapalgo, & + stream_yearFirst, stream_yearLast, stream_yearAlign, & + stream_offset, stream_taxmode, stream_tintalgo, stream_dtlimit, & + stream_fldlistFile, stream_fldListModel, stream_fileNames, & + logunit, compname) ! -------------------------------------------------------- ! set values of stream datatype independent of a reading in a stream text file @@ -356,14 +378,17 @@ subroutine shr_stream_init_from_inline(streamdat, stream_meshfile, stream_mapalg ! -------------------------------------------------------- ! input/output variables - type(shr_stream_streamType) , pointer, intent(inout) :: streamdat(:) ! data streams (assume 1 below) + type(shr_stream_streamType) ,pointer, intent(inout) :: streamdat(:) ! data streams (assume 1 below) character(*) ,intent(in) :: stream_meshFile ! full pathname to stream mesh file + character(*) ,intent(in) :: stream_lev_dimname ! name of vertical dimension in stream character(*) ,intent(in) :: stream_mapalgo ! stream mesh -> model mesh mapping type integer ,intent(in) :: stream_yearFirst ! first year to use integer ,intent(in) :: stream_yearLast ! last year to use integer ,intent(in) :: stream_yearAlign ! align yearFirst with this model year + character(*) ,intent(in) :: stream_tintalgo ! time interpolation algorithm integer ,intent(in) :: stream_offset ! offset in seconds of stream data character(*) ,intent(in) :: stream_taxMode ! time axis mode + real(r8) ,intent(in) :: stream_dtlimit ! ratio of max/min stream delta times character(*) ,intent(in) :: stream_fldListFile(:) ! file field names, colon delim list character(*) ,intent(in) :: stream_fldListModel(:) ! model field names, colon delim list character(*) ,intent(in) :: stream_filenames(:) ! stream data filenames (full pathnamesa) @@ -382,13 +407,18 @@ subroutine shr_stream_init_from_inline(streamdat, stream_meshfile, stream_mapalg allocate(streamdat(1)) ! overwrite default values + streamdat(1)%meshFile = trim(stream_meshFile) + streamdat(1)%lev_dimname = trim(stream_lev_dimname) + streamdat(1)%mapalgo = trim(stream_mapalgo) + streamdat(1)%yearFirst = stream_yearFirst streamdat(1)%yearLast = stream_yearLast streamdat(1)%yearAlign = stream_yearAlign + + streamdat(1)%tinterpAlgo = trim(stream_tintalgo) streamdat(1)%offset = stream_offset streamdat(1)%taxMode = trim(stream_taxMode) - streamdat(1)%meshFile = trim(stream_meshFile) - streamdat(1)%mapalgo = trim(stream_mapalgo) + streamdat(1)%dtlimit = stream_dtlimit streamdat(1)%pio_subsystem => shr_pio_getiosys(trim(compname)) streamdat(1)%pio_iotype = shr_pio_getiotype(trim(compname)) @@ -414,7 +444,7 @@ subroutine shr_stream_init_from_inline(streamdat, stream_meshfile, stream_mapalg streamdat(1)%varlist(n)%nameinmodel = trim(stream_fldlistModel(n)) end do - ! Get initial calendar value + ! Get stream calendar call shr_stream_getCalendar(streamdat(1), 1, calendar) streamdat(1)%calendar = trim(calendar) @@ -1161,7 +1191,7 @@ subroutine shr_stream_getCalendar(strm, k, calendar) character(*) ,intent(out) :: calendar ! calendar name ! local - integer :: fid, vid, n + integer :: vid, n character(CL) :: fileName,lcal integer :: old_handle integer :: rCode @@ -1359,7 +1389,7 @@ subroutine shr_stream_restIO(pioid, streams, mode) type(var_desc_t) :: varid, tvarid, dvarid, ntvarid, hdvarid integer :: rcode integer :: dimid_stream, dimid_files,dimid_nt, dimid_str - integer :: nt, n, k, maxnfiles=0 + integer :: n, k, maxnfiles=0 integer :: maxnt = 0 integer, allocatable :: tmp(:) character(len=CL) :: fname diff --git a/streams/dshr_tinterp_mod.F90 b/streams/dshr_tinterp_mod.F90 index f48fa8d3f..8379cd824 100644 --- a/streams/dshr_tinterp_mod.F90 +++ b/streams/dshr_tinterp_mod.F90 @@ -5,7 +5,7 @@ module dshr_tInterp_mod !--------------------------------------------------------------- use ESMF - use shr_kind_mod , only : i8=>shr_kind_i8, r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl + use shr_kind_mod , only : i8=>shr_kind_i8, r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl, shr_kind_in use shr_sys_mod , only : shr_sys_abort use shr_cal_mod , only : shr_cal_timeSet, shr_cal_advDateInt, shr_cal_date2julian use shr_orb_mod , only : shr_orb_cosz, shr_orb_decl, SHR_ORB_UNDEF_REAL @@ -222,7 +222,7 @@ subroutine shr_tInterp_getAvgCosz(tavCosz, lon, lat, & ldt8 = modeldt if (mod(dtsec,ldt8) /= 0) then ldt8 = (dtsec)/((dtsec)/ldt8+1) - ldt = ldt8 + ldt = int(ldt8, shr_kind_in) endif ! compute time average @@ -250,7 +250,7 @@ subroutine shr_tInterp_getAvgCosz(tavCosz, lon, lat, & timeint = reday2-reday0 call ESMF_TimeIntervalGet(timeint, s_i8=dtsec, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ldt = dtsec + ldt = int(dtsec, shr_kind_in) endif !--- get next cosz value for t-avg --- From d0a8444325102da007b049f9841d43735237a6b8 Mon Sep 17 00:00:00 2001 From: BinLi-NOAA Date: Fri, 11 Dec 2020 12:18:00 -0500 Subject: [PATCH 02/10] Add subroutines used for CFSR data source (#5) Fortran subroutines used for CFSR data source are added. The updated code can be compiled successfully on Hera. --- datm/CMakeLists.txt | 1 + datm/atm_comp_nuopc.F90 | 22 ++ datm/datm_datamode_cfsr_mod.F90 | 349 ++++++++++++++++++++++++++++++++ 3 files changed, 372 insertions(+) create mode 100644 datm/datm_datamode_cfsr_mod.F90 diff --git a/datm/CMakeLists.txt b/datm/CMakeLists.txt index a39d02e23..74fc5f194 100644 --- a/datm/CMakeLists.txt +++ b/datm/CMakeLists.txt @@ -4,6 +4,7 @@ add_library(datm atm_comp_nuopc.F90 datm_datamode_clmncep_mod.F90 datm_datamode_core2_mod.F90 datm_datamode_jra_mod.F90 + datm_datamode_cfsr_mod.F90 datm_datamode_era5_mod.F90) add_dependencies(datm dshr streams) diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index 0b0103807..5b6da3eae 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -46,6 +46,11 @@ module atm_comp_nuopc use datm_datamode_era5_mod , only : datm_datamode_era5_advance use datm_datamode_era5_mod , only : datm_datamode_era5_restart_write use datm_datamode_era5_mod , only : datm_datamode_era5_restart_read + use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_advertise + use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_init_pointers + use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_advance + use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_restart_write + use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_restart_read implicit none private ! except @@ -284,6 +289,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) trim(datamode) == 'CORE2_IAF' .or. & trim(datamode) == 'CORE_IAF_JRA' .or. & trim(datamode) == 'CLMNCEP' .or. & + trim(datamode) == 'CFSR' .or. & trim(datamode) == 'ERA5') then else call shr_sys_abort(' ERROR illegal datm datamode = '//trim(datamode)) @@ -305,6 +311,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) case ('ERA5') call datm_datamode_era5_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case ('CFSR') + call datm_datamode_cfsr_advertise(exportState, fldsExport, flds_scalar_name, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end select end subroutine InitializeAdvertise @@ -541,6 +550,9 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe case('ERA5') call datm_datamode_era5_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('CFSR') + call datm_datamode_cfsr_init_pointers(exportState, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end select ! Read restart if needed @@ -554,6 +566,8 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe call datm_datamode_clmncep_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) case('ERA5') call datm_datamode_era5_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) + case('CFSR') + call datm_datamode_cfsr_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) end select end if @@ -598,6 +612,10 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe call datm_datamode_era5_advance(exportstate, masterproc, logunit, mpicom, target_ymd, & target_tod, sdat%model_calendar, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('CFSR') + call datm_datamode_cfsr_advance(exportstate, masterproc, logunit, mpicom, target_ymd, & + target_tod, sdat%model_calendar, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end select ! Write restarts if needed @@ -619,6 +637,10 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe call datm_datamode_era5_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('CFSR') + call datm_datamode_cfsr_restart_write(case_name, inst_suffix, target_ymd, target_tod, & + logunit, my_task, sdat) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end select end if diff --git a/datm/datm_datamode_cfsr_mod.F90 b/datm/datm_datamode_cfsr_mod.F90 new file mode 100644 index 000000000..0b1ec3e2f --- /dev/null +++ b/datm/datm_datamode_cfsr_mod.F90 @@ -0,0 +1,349 @@ +module datm_datamode_cfsr_mod + + use ESMF + use NUOPC , only : NUOPC_Advertise + use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs + use shr_sys_mod , only : shr_sys_abort + use shr_precip_mod , only : shr_precip_partition_rain_snow_ramp + use shr_mpi_mod , only : shr_mpi_max + use shr_const_mod , only : shr_const_tkfrz, shr_const_rhofw, shr_const_rdair + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer + use dshr_mod , only : dshr_restart_read, dshr_restart_write + use dshr_strdata_mod , only : shr_strdata_type + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + + implicit none + private ! except + + public :: datm_datamode_cfsr_advertise + public :: datm_datamode_cfsr_init_pointers + public :: datm_datamode_cfsr_advance + public :: datm_datamode_cfsr_restart_write + public :: datm_datamode_cfsr_restart_read + + ! export state data + real(r8), pointer :: Sa_z(:) => null() + real(r8), pointer :: Sa_u(:) => null() + real(r8), pointer :: Sa_v(:) => null() + real(r8), pointer :: Sa_wspd(:) => null() + real(r8), pointer :: Sa_tbot(:) => null() + real(r8), pointer :: Sa_ptem(:) => null() + real(r8), pointer :: Sa_shum(:) => null() + real(r8), pointer :: Sa_dens(:) => null() + real(r8), pointer :: Sa_pbot(:) => null() + real(r8), pointer :: Faxa_lwdn(:) => null() + real(r8), pointer :: Faxa_lwnet(:) => null() + real(r8), pointer :: Faxa_rain(:) => null() +! real(r8), pointer :: Faxa_rainc(:) => null() +! real(r8), pointer :: Faxa_rainl(:) => null() +! real(r8), pointer :: Faxa_snowc(:) => null() + real(r8), pointer :: Faxa_snowl(:) => null() + real(r8), pointer :: Faxa_swndr(:) => null() + real(r8), pointer :: Faxa_swndf(:) => null() + real(r8), pointer :: Faxa_swvdr(:) => null() + real(r8), pointer :: Faxa_swvdf(:) => null() + real(r8), pointer :: Faxa_swnet(:) => null() +! real(r8), pointer :: Faxa_swdn(:) => null() + real(r8), pointer :: Faxa_sen(:) => null() + real(r8), pointer :: Faxa_lat(:) => null() + real(r8), pointer :: Faxa_taux(:) => null() + real(r8), pointer :: Faxa_tauy(:) => null() + + ! stream data + + real(r8) :: tbotmax ! units detector + + real(r8) , parameter :: tKFrz = SHR_CONST_TKFRZ + real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg + real(r8) , parameter :: rhofw = SHR_CONST_RHOFW ! density of fresh water ~ kg/m^3 + + character(*), parameter :: nullstr = 'undefined' + character(*), parameter :: rpfile = 'rpointer.atm' + character(*), parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine datm_datamode_cfsr_advertise(exportState, fldsexport, & + flds_scalar_name, rc) + + ! input/output variables + type(esmf_State) , intent(inout) :: exportState + type(fldlist_type) , pointer :: fldsexport + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(out) :: rc + + ! local variables + type(fldlist_type), pointer :: fldList + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) + + call dshr_fldList_add(fldsExport, 'Faxa_taux' ) + !call dshr_fldList_add(fldsExport, 'Dusfc' ) + + call dshr_fldList_add(fldsExport, 'Faxa_tauy' ) + !call dshr_fldList_add(fldsExport, 'Dvsfc' ) + + call dshr_fldList_add(fldsExport, 'Sa_z' ) + !call dshr_fldList_add(fldsExport, 'Zlowest' ) + + call dshr_fldList_add(fldsExport, 'Sa_tbot' ) + !call dshr_fldList_add(fldsExport, 'Tlowest' ) + + call dshr_fldList_add(fldsExport, 'Sa_shum' ) + !call dshr_fldList_add(fldsExport, 'Qlowest' ) + + call dshr_fldList_add(fldsExport, 'Sa_u' ) + !call dshr_fldList_add(fldsExport, 'Ulowest' ) + + call dshr_fldList_add(fldsExport, 'Sa_v' ) + !call dshr_fldList_add(fldsExport, 'Vlowest' ) + + call dshr_fldList_add(fldsExport, 'Sa_pbot' ) + !call dshr_fldList_add(fldsExport, 'Plowest' ) +! not in NEMSdatm + call dshr_fldList_add(fldsExport, 'Sa_ptem' ) +! only in NEMSdatm + !call dshr_fldList_add(fldsExport, 'T2m' ) + !call dshr_fldList_add(fldsExport, 'Q2m' ) + !call dshr_fldList_add(fldsExport, 'U10m' ) + !call dshr_fldList_add(fldsExport, 'V10m' ) + +! not in NEMSdatm + !call dshr_fldList_add(fldsExport, 'Faxa_swnet' ) + !call dshr_fldList_add(fldsExport, 'Faxa_swdn' ) + !call dshr_fldList_add(fldsExport, 'Dswrf' ) + + call dshr_fldList_add(fldsExport, 'Faxa_lwdn' ) + !call dshr_fldList_add(fldsExport, 'Dlwrf' ) + +! only in NEMSdatm + !call dshr_fldList_add(fldsExport, 'Ulwrf' ) + + call dshr_fldList_add(fldsExport, 'Faxa_lwnet' ) + !call dshr_fldList_add(fldsExport, 'Nlwrf' ) + + call dshr_fldList_add(fldsExport, 'Faxa_sen' ) + !call dshr_fldList_add(fldsExport, 'Shtfl' ) + + call dshr_fldList_add(fldsExport, 'Faxa_lat' ) + !call dshr_fldList_add(fldsExport, 'Lhtfl' ) + + call dshr_fldList_add(fldsExport, 'Faxa_swndr' ) + call dshr_fldList_add(fldsExport, 'Faxa_swndf' ) + call dshr_fldList_add(fldsExport, 'Faxa_swvdr' ) + call dshr_fldList_add(fldsExport, 'Faxa_swvdf' ) + !call dshr_fldList_add(fldsExport, 'Ndbsf' ) + !call dshr_fldList_add(fldsExport, 'Nddsf' ) + !call dshr_fldList_add(fldsExport, 'Vbdsf' ) + !call dshr_fldList_add(fldsExport, 'Vddsf' ) + +!not in NEMSdatm + call dshr_fldList_add(fldsExport, 'Sa_wspd' ) + !call dshr_fldList_add(fldsExport, 'Sa_tskn' ) + call dshr_fldList_add(fldsExport, 'Sa_dens' ) + + call dshr_fldList_add(fldsExport, 'Sa_pslv' ) + !call dshr_fldList_add(fldsExport, 'Psurf' ) + +!not in NEMSdatm + !call dshr_fldList_add(fldsExport, 'Faxa_rainc' ) + !call dshr_fldList_add(fldsExport, 'Faxa_rainl' ) + !call dshr_fldList_add(fldsExport, 'Faxa_snowc' ) + + call dshr_fldList_add(fldsExport, 'Faxa_rain' ) + !call dshr_fldList_add(fldsExport, 'Prate' ) + call dshr_fldList_add(fldsExport, 'Faxa_snowl' ) + + fldlist => fldsExport ! the head of the linked list + do while (associated(fldlist)) + call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite('(datm_comp_advertise): Fr_atm '//trim(fldList%stdname), ESMF_LOGMSG_INFO) + fldList => fldList%next + enddo + + end subroutine datm_datamode_cfsr_advertise + + !=============================================================================== + subroutine datm_datamode_cfsr_init_pointers(exportState, sdat, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(datm_init_pointers): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! get export state pointers + call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_v' , fldptr1=Sa_v , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_wspd' , fldptr1=Sa_wspd , allowNullReturn=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_tbot' , fldptr1=Sa_tbot , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_pbot' , fldptr1=Sa_pbot , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_ptem' , fldptr1=Sa_ptem , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_shum' , fldptr1=Sa_shum , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_dens' , fldptr1=Sa_dens , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_rain' , fldptr1=Faxa_rain , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return +! call dshr_state_getfldptr(exportState, 'Faxa_rainc' , fldptr1=Faxa_rainc , rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! call dshr_state_getfldptr(exportState, 'Faxa_rainl' , fldptr1=Faxa_rainl , rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! call dshr_state_getfldptr(exportState, 'Faxa_snowc' , fldptr1=Faxa_snowc , rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_snowl' , fldptr1=Faxa_snowl , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swvdr' , fldptr1=Faxa_swvdr , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swvdf' , fldptr1=Faxa_swvdf , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swndr' , fldptr1=Faxa_swndr , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swndf' , fldptr1=Faxa_swndf , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swnet' , fldptr1=Faxa_swnet , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return +! call dshr_state_getfldptr(exportState, 'Faxa_swdn' , fldptr1=Faxa_swdn , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_lwnet' , fldptr1=Faxa_lwnet , allowNullReturn=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_sen' , fldptr1=Faxa_sen , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_lat' , fldptr1=Faxa_lat , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_taux' , fldptr1=Faxa_taux , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_tauy' , fldptr1=Faxa_tauy , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end subroutine datm_datamode_cfsr_init_pointers + + !=============================================================================== + subroutine datm_datamode_cfsr_advance(exportstate, masterproc, logunit, mpicom, target_ymd, target_tod, model_calendar, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: exportState + logical , intent(in) :: masterproc + integer , intent(in) :: logunit + integer , intent(in) :: mpicom + integer , intent(in) :: target_ymd + integer , intent(in) :: target_tod + character(len=*) , intent(in) :: model_calendar + integer , intent(out) :: rc + + ! local variables + logical :: first_time = .true. + integer :: n ! indices + integer :: lsize ! size of attr vect + real(r8) :: rtmp + real(r8) :: tbot, pbot + real(r8) :: vp + real(r8) :: e, qsat + character(len=*), parameter :: subname='(datm_datamode_cfsr_advance): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + if (first_time) then + ! determine tbotmax (see below for use) + rtmp = maxval(Sa_tbot(:)) + call shr_mpi_max(rtmp, tbotmax, mpicom, 'datm_tbot', all=.true.) + if (masterproc) write(logunit,*) trim(subname),' tbotmax = ',tbotmax + + ! reset first_time + first_time = .false. + end if + + do n = 1, lsize + !--- bottom layer height --- + Sa_z(n) = 10.0_r8 + + !--- calculate wind speed --- + if (associated(Sa_wspd)) then + Sa_wspd(n) = sqrt(Sa_u(n)*Sa_u(n)+Sa_v(n)*Sa_v(n)) + end if + + !--- temperature --- + if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz + ! Limit very cold forcing to 180K + Sa_tbot(n) = max(180._r8, Sa_tbot(n)) + Sa_ptem(n) = Sa_tbot(n) + +! comment out + !--- specific humidity --- + tbot = Sa_tbot(n) + pbot = Sa_pbot(n) + + !--- density --- + vp = (Sa_shum(n)*pbot) / (0.622_r8 + 0.378_r8 * Sa_shum(n)) + Sa_dens(n) = (pbot - 0.378_r8 * vp) / (tbot*rdair) +! comment out + !--- shortwave radiation (Faxa_* basically holds albedo) --- +! Faxa_swvdr(n) = Faxa_swdn(n)*Faxa_swvdr(n) +! Faxa_swndr(n) = Faxa_swdn(n)*Faxa_swndr(n) +! Faxa_swvdf(n) = Faxa_swdn(n)*Faxa_swvdf(n) +! Faxa_swndf(n) = Faxa_swdn(n)*Faxa_swndf(n) +! comment out + end do + + end subroutine datm_datamode_cfsr_advance + + !=============================================================================== + subroutine datm_datamode_cfsr_restart_write(case_name, inst_suffix, ymd, tod, & + logunit, my_task, sdat) + + ! input/output variables + character(len=*) , intent(in) :: case_name + character(len=*) , intent(in) :: inst_suffix + integer , intent(in) :: ymd ! model date + integer , intent(in) :: tod ! model sec into model date + integer , intent(in) :: logunit + integer , intent(in) :: my_task + type(shr_strdata_type) , intent(inout) :: sdat + !------------------------------------------------------------------------------- + + call dshr_restart_write(rpfile, case_name, 'datm', inst_suffix, ymd, tod, & + logunit, my_task, sdat) + + end subroutine datm_datamode_cfsr_restart_write + + !=============================================================================== + subroutine datm_datamode_cfsr_restart_read(rest_filem, inst_suffix, logunit, my_task, mpicom, sdat) + + ! input/output arguments + character(len=*) , intent(inout) :: rest_filem + character(len=*) , intent(in) :: inst_suffix + integer , intent(in) :: logunit + integer , intent(in) :: my_task + integer , intent(in) :: mpicom + type(shr_strdata_type) , intent(inout) :: sdat + !------------------------------------------------------------------------------- + + call dshr_restart_read(rest_filem, rpfile, inst_suffix, nullstr, logunit, my_task, mpicom, sdat) + + end subroutine datm_datamode_cfsr_restart_read + +end module datm_datamode_cfsr_mod From 6983ee52198d0303d10d3c2c2dcd78f18f0ffefe Mon Sep 17 00:00:00 2001 From: BinLi-NOAA Date: Wed, 27 Jan 2021 13:33:44 -0500 Subject: [PATCH 03/10] Update emc/develop branch with recent changes in master branch of ESCOMP/CDEPS (#9) --- CMakeLists.txt | 59 ++++- cime_config/stream_cdeps.py | 9 +- cime_config/streams_v2.0.xsd | 19 +- datm/CMakeLists.txt | 36 ++- datm/atm_comp_nuopc.F90 | 43 +++- datm/cime_config/stream_definition_datm.xml | 238 ++++-------------- datm/datm_datamode_cfsr_mod.F90 | 162 ++---------- datm/datm_datamode_clmncep_mod.F90 | 17 +- datm/datm_datamode_core2_mod.F90 | 20 +- datm/datm_datamode_cplhist_mod.F90 | 234 +++++++++++++++++ datm/datm_datamode_era5_mod.F90 | 8 +- datm/datm_datamode_jra_mod.F90 | 8 +- dice/CMakeLists.txt | 16 +- dice/dice_datamode_ssmi_mod.F90 | 5 +- dice/dice_flux_atmice_mod.F90 | 19 +- dice/ice_comp_nuopc.F90 | 9 +- dlnd/CMakeLists.txt | 15 +- dlnd/cime_config/buildnml | 1 - dlnd/cime_config/namelist_definition_dlnd.xml | 5 +- dlnd/lnd_comp_nuopc.F90 | 9 +- docn/CMakeLists.txt | 16 +- docn/cime_config/buildnml | 5 +- docn/cime_config/namelist_definition_docn.xml | 10 +- docn/docn_datamode_aquaplanet_mod.F90 | 4 +- docn/docn_datamode_copyall_mod.F90 | 22 +- docn/docn_datamode_iaf_mod.F90 | 4 +- docn/docn_datamode_som_mod.F90 | 14 +- docn/ocn_comp_nuopc.F90 | 8 +- drof/CMakeLists.txt | 15 +- drof/rof_comp_nuopc.F90 | 8 +- dshr/CMakeLists.txt | 18 +- dshr/dshr_dfield_mod.F90 | 5 +- dshr/dshr_fldlist_mod.F90 | 8 +- dshr/dshr_mod.F90 | 193 ++++++++++---- dwav/CMakeLists.txt | 17 +- dwav/wav_comp_nuopc.F90 | 8 +- share/CMakeLists.txt | 4 +- streams/CMakeLists.txt | 15 +- streams/dshr_methods_mod.F90 | 128 +++++----- streams/dshr_strdata_mod.F90 | 104 ++++---- streams/dshr_stream_mod.F90 | 139 +++++----- streams/dshr_tinterp_mod.F90 | 15 +- 42 files changed, 986 insertions(+), 706 deletions(-) create mode 100644 datm/datm_datamode_cplhist_mod.F90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 734fec8de..2e764ab3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,13 +27,22 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) message("CMAKE_MODULE_PATH is ${CMAKE_MODULE_PATH}") -find_package(ESMF REQUIRED) -if (DEFINED PIO) - set(PIO_PATH ${PIO}) +if (TARGET esmf) + message("Target esmf is already found. Skip find_package ...") else() - set(PIO_PATH $ENV{PIO}) + find_package(ESMF REQUIRED) +endif() + +if (DEFINED ENV{PIO_ROOT}) + message("PIO_ROOT is $ENV{PIO_ROOT}") +else() + if (DEFINED PIO) + set(PIO_PATH ${PIO}) + else() + set(PIO_PATH $ENV{PIO}) + endif() + find_package(PIO REQUIRED COMPONENT C Fortran PATH ${PIO_PATH}) endif() -find_package(PIO REQUIRED COMPONENT C Fortran PATH ${PIO_PATH}) if (NOT DEFINED MPILIB OR NOT ${MPILIB} STREQUAL "mpi-serial") find_package(MPI REQUIRED) @@ -53,5 +62,41 @@ foreach(COMP datm dice dlnd docn drof dwav) add_subdirectory("${COMP}") endforeach(COMP) -install(TARGETS streams dshr - LIBRARY DESTINATION lib) +target_include_directories(streams PUBLIC $ + $) +target_include_directories(streams PUBLIC $ + $) +target_include_directories(dshr PUBLIC $ + $) +target_include_directories(dshr PUBLIC $ + $) +target_include_directories(dshr PUBLIC $ + $) + +foreach(COMP datm dice dlnd docn drof dwav) + target_include_directories(${COMP} PUBLIC $ + $) + target_include_directories(${COMP} PUBLIC $ + $) + target_include_directories(${COMP} PUBLIC $ + $) + + install(TARGETS ${COMP} + EXPORT ${COMP} + LIBRARY DESTINATION lib + COMPONENT Library) + install(EXPORT ${COMP} + DESTINATION lib/cmake) +endforeach(COMP) + +foreach(DEPS streams dshr cdeps_share FoX_dom FoX_wxml FoX_sax FoX_common FoX_utils FoX_fsys) + if(NOT BLD_STANDALONE AND ${DEPS} STREQUAL "cdeps_share") + continue() + endif() + install(TARGETS ${DEPS} + EXPORT ${DEPS} + LIBRARY DESTINATION lib + COMPONENT Library) + install(EXPORT ${DEPS} + DESTINATION lib/cmake) +endforeach(COMP) diff --git a/cime_config/stream_cdeps.py b/cime_config/stream_cdeps.py index 9f69f6693..3cbb2aa0b 100644 --- a/cime_config/stream_cdeps.py +++ b/cime_config/stream_cdeps.py @@ -99,8 +99,12 @@ def create_stream_xml(self, stream_names, case, streams_xml_file, data_list_file stream_datafiles = child.xml_element.text stream_datafiles = self._resolve_values(case, stream_datafiles) if 'first_year' in child.xml_element.attrib and 'last_year' in child.xml_element.attrib: - stream_year_first= int(child.xml_element.get('first_year')) - stream_year_last = int(child.xml_element.get('last_year')) + value = child.xml_element.get('first_year') + value = self._resolve_values(case, value) + stream_year_first= int(value) + value = child.xml_element.get('last_year') + value = self._resolve_values(case, value) + stream_year_last = int(value) year_first = max(stream_year_first, data_year_first) year_last = min(stream_year_last, data_year_last) stream_datafiles = self._sub_paths(stream_datafiles, year_first, year_last) @@ -117,6 +121,7 @@ def create_stream_xml(self, stream_names, case, streams_xml_file, data_list_file or node_name == 'stream_taxmode' or node_name == 'stream_dtlimit'): attributes['model_grid'] = case.get_value("GRID") + attributes['compset'] = case.get_value("COMPSET") value = self._get_value_match(node, node_name[7:], attributes=attributes) value = self._resolve_values(case, value) value = value.strip() diff --git a/cime_config/streams_v2.0.xsd b/cime_config/streams_v2.0.xsd index 2509cf25c..1197a1319 100644 --- a/cime_config/streams_v2.0.xsd +++ b/cime_config/streams_v2.0.xsd @@ -6,9 +6,10 @@ - - + + + @@ -16,9 +17,9 @@ - - - + + + @@ -32,13 +33,13 @@ - + - + @@ -76,6 +77,7 @@ + @@ -100,6 +102,7 @@ + @@ -125,6 +128,7 @@ + @@ -142,6 +146,7 @@ + diff --git a/datm/CMakeLists.txt b/datm/CMakeLists.txt index 74fc5f194..fb3f85736 100644 --- a/datm/CMakeLists.txt +++ b/datm/CMakeLists.txt @@ -1,16 +1,28 @@ project(datm Fortran) +set(SRCFILES atm_comp_nuopc.F90 + datm_datamode_clmncep_mod.F90 + datm_datamode_cplhist_mod.F90 + datm_datamode_core2_mod.F90 + datm_datamode_jra_mod.F90 + datm_datamode_cfsr_mod.F90 + datm_datamode_era5_mod.F90) -add_library(datm atm_comp_nuopc.F90 - datm_datamode_clmncep_mod.F90 - datm_datamode_core2_mod.F90 - datm_datamode_jra_mod.F90 - datm_datamode_cfsr_mod.F90 - datm_datamode_era5_mod.F90) +foreach(FILE ${SRCFILES}) + if(EXISTS "${CASEROOT}/SourceMods/src.datm/${FILE}") + list(REMOVE_ITEM SRCFILES ${FILE}) + list(APPEND SRCFILES "${CASEROOT}/SourceMods/src.datm/${FILE}") + message("Using ${FILE} from ${CASEROOT}/SourceMods/src.datm") + endif() +endforeach() + +message("DATM srcfiles are ${SRCFILES}") + +add_library(datm ${SRCFILES}) add_dependencies(datm dshr streams) -target_include_directories (datm PUBLIC ${ESMF_F90COMPILEPATHS}) -target_include_directories (datm PUBLIC "${CMAKE_BINARY_DIR}/dshr") -target_include_directories (datm PUBLIC "${CMAKE_SOURCE_DIR}") -target_include_directories (datm PUBLIC "${CMAKE_BINARY_DIR}/share") -target_include_directories (datm PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (datm PUBLIC "${PIO_Fortran_INCLUDE_DIR}") +target_include_directories (datm PRIVATE ${ESMF_F90COMPILEPATHS}) +target_include_directories (datm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/dshr) +target_include_directories (datm PRIVATE ${CMAKE_SOURCE_DIR}) +target_include_directories (datm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) +target_include_directories (datm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/streams) +target_include_directories (datm PRIVATE ${PIO_Fortran_INCLUDE_DIR}) diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index 5b6da3eae..a446e10e6 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -4,7 +4,15 @@ module atm_comp_nuopc ! This is the NUOPC cap for DATM !---------------------------------------------------------------------------- - use ESMF + use ESMF , only : ESMF_Mesh, ESMF_GridComp, ESMF_SUCCESS, ESMF_LogWrite + use ESMF , only : ESMF_GridCompSetEntryPoint, ESMF_METHOD_INITIALIZE + use ESMF , only : ESMF_MethodRemove, ESMF_State, ESMF_Clock, ESMF_TimeInterval + use ESMF , only : ESMF_State, ESMF_Field, ESMF_LOGMSG_INFO, ESMF_ClockGet + use ESMF , only : ESMF_Time, ESMF_Alarm, ESMF_TimeGet, ESMF_TimeInterval + use ESMF , only : operator(+), ESMF_TimeIntervalGet, ESMF_ClockGetAlarm + use ESMF , only : ESMF_AlarmIsRinging, ESMF_AlarmRingerOff, ESMF_StateGet + use ESMF , only : ESMF_FieldGet, ESMF_MAXSTR + use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise use NUOPC_Model , only : model_routine_SS => SetServices @@ -26,21 +34,31 @@ module atm_comp_nuopc use dshr_mod , only : dshr_orbital_init, dshr_orbital_update use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize + use datm_datamode_core2_mod , only : datm_datamode_core2_advertise use datm_datamode_core2_mod , only : datm_datamode_core2_init_pointers use datm_datamode_core2_mod , only : datm_datamode_core2_advance use datm_datamode_core2_mod , only : datm_datamode_core2_restart_write use datm_datamode_core2_mod , only : datm_datamode_core2_restart_read + use datm_datamode_jra_mod , only : datm_datamode_jra_advertise use datm_datamode_jra_mod , only : datm_datamode_jra_init_pointers use datm_datamode_jra_mod , only : datm_datamode_jra_advance use datm_datamode_jra_mod , only : datm_datamode_jra_restart_write use datm_datamode_jra_mod , only : datm_datamode_jra_restart_read + use datm_datamode_clmncep_mod , only : datm_datamode_clmncep_advertise use datm_datamode_clmncep_mod , only : datm_datamode_clmncep_init_pointers use datm_datamode_clmncep_mod , only : datm_datamode_clmncep_advance use datm_datamode_clmncep_mod , only : datm_datamode_clmncep_restart_write use datm_datamode_clmncep_mod , only : datm_datamode_clmncep_restart_read + + use datm_datamode_cplhist_mod , only : datm_datamode_cplhist_advertise + use datm_datamode_cplhist_mod , only : datm_datamode_cplhist_init_pointers + use datm_datamode_cplhist_mod , only : datm_datamode_cplhist_advance + use datm_datamode_cplhist_mod , only : datm_datamode_cplhist_restart_write + use datm_datamode_cplhist_mod , only : datm_datamode_cplhist_restart_read + use datm_datamode_era5_mod , only : datm_datamode_era5_advertise use datm_datamode_era5_mod , only : datm_datamode_era5_init_pointers use datm_datamode_era5_mod , only : datm_datamode_era5_advance @@ -52,6 +70,12 @@ module atm_comp_nuopc use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_restart_write use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_restart_read + use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_advertise + use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_init_pointers + use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_advance + use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_restart_write + use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_restart_read + implicit none private ! except @@ -289,6 +313,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) trim(datamode) == 'CORE2_IAF' .or. & trim(datamode) == 'CORE_IAF_JRA' .or. & trim(datamode) == 'CLMNCEP' .or. & + trim(datamode) == 'CPLHIST' .or. & trim(datamode) == 'CFSR' .or. & trim(datamode) == 'ERA5') then else @@ -308,6 +333,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call datm_datamode_clmncep_advertise(exportState, fldsExport, flds_scalar_name, & flds_co2, flds_wiso, flds_presaero, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case ('CPLHIST') + call datm_datamode_cplhist_advertise(exportState, fldsExport, flds_scalar_name, & + flds_co2, flds_wiso, flds_presaero, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('ERA5') call datm_datamode_era5_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -547,6 +576,9 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe case('CLMNCEP') call datm_datamode_clmncep_init_pointers(importState, exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('CPLHIST') + call datm_datamode_cplhist_init_pointers(importState, exportState, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return case('ERA5') call datm_datamode_era5_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -564,6 +596,8 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe call datm_datamode_jra_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) case('CLMNCEP') call datm_datamode_clmncep_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) + case('CPLHIST') + call datm_datamode_cplhist_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) case('ERA5') call datm_datamode_era5_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) case('CFSR') @@ -608,6 +642,9 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe case('CLMNCEP') call datm_datamode_clmncep_advance(masterproc, logunit, mpicom, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('CPLHIST') + call datm_datamode_cplhist_advance(masterproc, logunit, mpicom, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return case('ERA5') call datm_datamode_era5_advance(exportstate, masterproc, logunit, mpicom, target_ymd, & target_tod, sdat%model_calendar, rc) @@ -633,6 +670,10 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe call datm_datamode_clmncep_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('CPLHIST') + call datm_datamode_cplhist_restart_write(case_name, inst_suffix, target_ymd, target_tod, & + logunit, my_task, sdat) + if (ChkErr(rc,__LINE__,u_FILE_u)) return case('ERA5') call datm_datamode_era5_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index 732ab38d3..d7a957bc3 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -18,6 +18,11 @@ %ym => year-month from the range yearfirst to yearlast with all 12 months %ymd => year-month-day from the range yearfirst to yearlast with all 12 months + ****** + NOTE: + any entry that has %y, %ym or %ymd MUST have first_year and last_year syntax + ****** + Each mode below, except for presaero, has a set of streams associated with it The presaero stream, is associated with all modes @@ -218,11 +223,9 @@ cycle - extend 1.5 - 1.e30 single @@ -252,11 +255,9 @@ cycle - extend 1.5 - 1.e30 single @@ -290,11 +291,9 @@ cycle - extend 1.5 - 1.e30 single @@ -316,7 +315,6 @@ null bilinear - nn null $DATM_CLMNCEP_YR_ALIGN @@ -328,11 +326,9 @@ cycle - extend 1.5 - 1.e30 single @@ -350,7 +346,6 @@ null bilinear - nn null $DATM_CLMNCEP_YR_ALIGN @@ -362,11 +357,9 @@ cycle - extend 1.5 - 1.e30 single @@ -399,11 +392,9 @@ cycle - extend 1.5 - 1.e30 single @@ -437,11 +428,9 @@ cycle - extend 1.5 - 1.e30 single @@ -471,11 +460,9 @@ cycle - extend 1.5 - 1.e30 single @@ -508,11 +495,9 @@ cycle - extend 1.5 - 1.e30 single @@ -546,11 +531,9 @@ cycle - extend 1.5 - 1.e30 single @@ -560,7 +543,7 @@ $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.Qian.T62.c080727/clmforc.Qian.c2006.T62.ESMFmesh_120620.nc - $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/Precip6Hrly/clmforc.Qian.c2006.T62.Prec.%ym.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing_iso.datm7.Qian.T62.c080727/Precip6Hrly/clmforc.Qian.c2006.T62.Prec.%ym.nc PRECTmms Faxa_precn @@ -580,11 +563,9 @@ cycle - extend 1.5 - 1.e30 single @@ -617,17 +598,15 @@ cycle - extend 1.5 - 1.e30 single - + @@ -642,8 +621,7 @@ null - bilinear - nn + redist null $DATM_CLMNCEP_YR_ALIGN @@ -655,11 +633,9 @@ cycle - extend 1.5 - 1.e30 single @@ -676,8 +652,7 @@ null - bilinear - nn + redist null $DATM_CLMNCEP_YR_ALIGN @@ -689,11 +664,9 @@ cycle - extend 1.5 - 1.e30 single @@ -714,8 +687,7 @@ null - bilinear - nn + redist null $DATM_CLMNCEP_YR_ALIGN @@ -727,11 +699,9 @@ cycle - extend 1.5 - 1.e30 single @@ -745,7 +715,7 @@ none - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/mexicocityMEX.c080124/clm1pt-1993-12.nc + $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/mexicocityMEX.c080124/clm1pt-1993-12.nc ZBOT Sa_z @@ -881,10 +851,10 @@ - + $DIN_LOC_ROOT/share/meshes/bias_correction_gpcp_qian.Prec_ESMFmesh_cdf5_110121.nc - $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/gpcp/qian/bias_correction.Prec.%y.nc + $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/gpcp/qian/bias_correction.Prec.%y.nc BC_PREC Faxa_precsf @@ -904,21 +874,19 @@ cycle - extend 1.5 - 1.e30 single - + $DIN_LOC_ROOT/share/meshes/bias_correction_gpcp_cruncep.Prec_ESMFmesh_cdf5_110121.nc - $DIN_LOC_ROOT/atm/datm7/clm_output/cruncep_precip_1deg/gpcp_1deg_bias_correction/bias_correction.Prec.%y.nc + $DIN_LOC_ROOT/atm/datm7/clm_output/cruncep_precip_1deg/gpcp_1deg_bias_correction/bias_correction.Prec.%y.nc BC_PREC Faxa_precsf @@ -938,21 +906,19 @@ cycle - extend 1.5 - 1.e30 single - + $DIN_LOC_ROOT/share/meshes/bias_correction_gpcp_cmap.Prec_ESMFmesh_cdf5_110121.nc - $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/cmap/cruncep/bias_correction.Prec.%y.nc + $DIN_LOC_ROOT/atm/datm7/bias_correction/precip/cmap/cruncep/bias_correction.Prec.%y.nc BC_PREC Faxa_precsf @@ -972,11 +938,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1010,11 +974,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1044,11 +1006,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1078,11 +1038,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1112,11 +1070,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1146,11 +1102,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1180,11 +1134,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1214,11 +1166,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1248,11 +1198,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1288,11 +1236,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1322,11 +1268,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1361,11 +1305,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1399,11 +1341,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1433,11 +1373,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1467,11 +1405,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1501,11 +1437,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1535,11 +1469,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1569,11 +1501,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1603,11 +1533,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1637,11 +1565,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1671,11 +1597,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1705,11 +1629,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1740,11 +1662,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1775,11 +1695,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1810,11 +1728,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1845,11 +1761,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1882,11 +1796,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1919,11 +1831,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1956,11 +1866,9 @@ cycle - extend 1.5 - 1.e30 single @@ -1993,11 +1901,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2030,11 +1936,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2067,11 +1971,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2101,7 +2003,6 @@ cycle - extend 1.e30 @@ -2146,11 +2047,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2180,11 +2079,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2214,11 +2111,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2248,11 +2143,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2282,11 +2175,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2316,11 +2207,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2350,11 +2239,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2384,11 +2271,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2418,7 +2303,6 @@ cycle - extend 1.e30 @@ -2490,11 +2374,9 @@ cycle - extend 1.5 - 1.e30 single @@ -2518,7 +2400,6 @@ null none - nn null 1850 @@ -2530,7 +2411,6 @@ extend - extend 1.e30 @@ -2551,7 +2431,6 @@ null none - nn null 213 @@ -2562,12 +2441,10 @@ linear - cycle - extend + extend - 1.5 - 1.e30 + 1.e30 single @@ -2585,7 +2462,6 @@ null none - nn null 198 @@ -2596,12 +2472,10 @@ linear - cycle - extend + extend - 1.5 - 1.e30 + 1.e30 single @@ -2631,7 +2505,6 @@ extend - extend 1.e30 @@ -2664,7 +2537,6 @@ extend - extend 1.e30 @@ -2697,7 +2569,6 @@ extend - extend 1.e30 @@ -2730,7 +2601,6 @@ extend - extend 1.e30 @@ -2763,7 +2633,6 @@ extend - extend 1.e30 @@ -2796,7 +2665,6 @@ extend - extend 1.e30 @@ -2829,7 +2697,6 @@ extend - extend 1.e30 @@ -2862,7 +2729,6 @@ extend - extend 1.e30 @@ -2895,7 +2761,6 @@ extend - extend 1.e30 @@ -2928,7 +2793,6 @@ extend - extend 1.e30 @@ -2961,7 +2825,6 @@ extend - extend 1.e30 @@ -2994,7 +2857,6 @@ extend - extend 1.e30 @@ -3027,7 +2889,6 @@ extend - extend 1.e30 @@ -3060,7 +2921,6 @@ extend - extend 1.e30 @@ -3093,7 +2953,6 @@ extend - extend 1.e30 @@ -3126,7 +2985,6 @@ extend - extend 1.e30 @@ -3165,7 +3023,6 @@ bilinear nn - nn null 1 @@ -3177,11 +3034,11 @@ cycle - extend + extend 1.5 - 1.e30 + 1.e30 single @@ -3213,7 +3070,6 @@ bilinear nn - nn null 1 @@ -3225,11 +3081,11 @@ cycle - extend + extend 1.5 - 1.e30 + 1.e30 single @@ -3261,7 +3117,6 @@ bilinear nn - nn null 1 @@ -3273,11 +3128,11 @@ cycle - extend + extend 1.5 - 1.e30 + 1.e30 single @@ -3320,11 +3175,11 @@ cycle - extend + extend 1.5 - 1.e30 + 1.e30 single @@ -3367,11 +3222,11 @@ cycle - extend + extend 1.5 - 1.e30 + 1.e30 single @@ -3414,11 +3269,11 @@ cycle - extend + extend 1.5 - 1.e30 + 1.e30 single @@ -3461,10 +3316,11 @@ cycle - extend + extend 1.5 + 1.e30 single @@ -3507,11 +3363,11 @@ cycle - extend + extend 1.5 - 1.e30 + 1.e30 single @@ -3571,7 +3427,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc a2x3h_Sa_topo Sa_topo @@ -3591,7 +3447,6 @@ cycle - extend 3.0 @@ -3603,7 +3458,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1d.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1d.%ym.nc a2x1d_Faxa_bcphiwet Faxa_bcphiwet @@ -3636,7 +3491,6 @@ cycle - extend 3.0 @@ -3649,7 +3503,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1hi.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1hi.%ym.nc a2x1hi_Faxa_swndr Faxa_swndr @@ -3672,7 +3526,6 @@ cycle - extend 3.0 @@ -3685,7 +3538,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc a2x3h_Faxa_rainc Faxa_rainc @@ -3709,7 +3562,6 @@ cycle - extend 3.0 @@ -3722,7 +3574,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc a2x3h_Sa_z Sa_z @@ -3750,7 +3602,6 @@ cycle - extend 3.0 @@ -3763,7 +3614,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1h.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1h.%ym.nc a2x1h_Sa_u Sa_u @@ -3784,7 +3635,6 @@ cycle - extend 3.0 @@ -3825,11 +3675,9 @@ cycle - extend 1.5 - 1.e30 single diff --git a/datm/datm_datamode_cfsr_mod.F90 b/datm/datm_datamode_cfsr_mod.F90 index 0b1ec3e2f..2b0efb849 100644 --- a/datm/datm_datamode_cfsr_mod.F90 +++ b/datm/datm_datamode_cfsr_mod.F90 @@ -26,33 +26,22 @@ module datm_datamode_cfsr_mod real(r8), pointer :: Sa_z(:) => null() real(r8), pointer :: Sa_u(:) => null() real(r8), pointer :: Sa_v(:) => null() - real(r8), pointer :: Sa_wspd(:) => null() real(r8), pointer :: Sa_tbot(:) => null() - real(r8), pointer :: Sa_ptem(:) => null() real(r8), pointer :: Sa_shum(:) => null() - real(r8), pointer :: Sa_dens(:) => null() real(r8), pointer :: Sa_pbot(:) => null() real(r8), pointer :: Faxa_lwdn(:) => null() - real(r8), pointer :: Faxa_lwnet(:) => null() real(r8), pointer :: Faxa_rain(:) => null() -! real(r8), pointer :: Faxa_rainc(:) => null() -! real(r8), pointer :: Faxa_rainl(:) => null() -! real(r8), pointer :: Faxa_snowc(:) => null() - real(r8), pointer :: Faxa_snowl(:) => null() + real(r8), pointer :: Faxa_snow(:) => null() real(r8), pointer :: Faxa_swndr(:) => null() real(r8), pointer :: Faxa_swndf(:) => null() real(r8), pointer :: Faxa_swvdr(:) => null() real(r8), pointer :: Faxa_swvdf(:) => null() - real(r8), pointer :: Faxa_swnet(:) => null() -! real(r8), pointer :: Faxa_swdn(:) => null() - real(r8), pointer :: Faxa_sen(:) => null() - real(r8), pointer :: Faxa_lat(:) => null() - real(r8), pointer :: Faxa_taux(:) => null() - real(r8), pointer :: Faxa_tauy(:) => null() ! stream data + real(r8), pointer :: strm_mask(:) => null() real(r8) :: tbotmax ! units detector + real(r8) :: maskmax ! units detector real(r8) , parameter :: tKFrz = SHR_CONST_TKFRZ real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg @@ -83,83 +72,19 @@ subroutine datm_datamode_cfsr_advertise(exportState, fldsexport, & rc = ESMF_SUCCESS call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) - - call dshr_fldList_add(fldsExport, 'Faxa_taux' ) - !call dshr_fldList_add(fldsExport, 'Dusfc' ) - - call dshr_fldList_add(fldsExport, 'Faxa_tauy' ) - !call dshr_fldList_add(fldsExport, 'Dvsfc' ) - call dshr_fldList_add(fldsExport, 'Sa_z' ) - !call dshr_fldList_add(fldsExport, 'Zlowest' ) - - call dshr_fldList_add(fldsExport, 'Sa_tbot' ) - !call dshr_fldList_add(fldsExport, 'Tlowest' ) - - call dshr_fldList_add(fldsExport, 'Sa_shum' ) - !call dshr_fldList_add(fldsExport, 'Qlowest' ) - call dshr_fldList_add(fldsExport, 'Sa_u' ) - !call dshr_fldList_add(fldsExport, 'Ulowest' ) - call dshr_fldList_add(fldsExport, 'Sa_v' ) - !call dshr_fldList_add(fldsExport, 'Vlowest' ) - + call dshr_fldList_add(fldsExport, 'Sa_tbot' ) call dshr_fldList_add(fldsExport, 'Sa_pbot' ) - !call dshr_fldList_add(fldsExport, 'Plowest' ) -! not in NEMSdatm - call dshr_fldList_add(fldsExport, 'Sa_ptem' ) -! only in NEMSdatm - !call dshr_fldList_add(fldsExport, 'T2m' ) - !call dshr_fldList_add(fldsExport, 'Q2m' ) - !call dshr_fldList_add(fldsExport, 'U10m' ) - !call dshr_fldList_add(fldsExport, 'V10m' ) - -! not in NEMSdatm - !call dshr_fldList_add(fldsExport, 'Faxa_swnet' ) - !call dshr_fldList_add(fldsExport, 'Faxa_swdn' ) - !call dshr_fldList_add(fldsExport, 'Dswrf' ) - - call dshr_fldList_add(fldsExport, 'Faxa_lwdn' ) - !call dshr_fldList_add(fldsExport, 'Dlwrf' ) - -! only in NEMSdatm - !call dshr_fldList_add(fldsExport, 'Ulwrf' ) - - call dshr_fldList_add(fldsExport, 'Faxa_lwnet' ) - !call dshr_fldList_add(fldsExport, 'Nlwrf' ) - - call dshr_fldList_add(fldsExport, 'Faxa_sen' ) - !call dshr_fldList_add(fldsExport, 'Shtfl' ) - - call dshr_fldList_add(fldsExport, 'Faxa_lat' ) - !call dshr_fldList_add(fldsExport, 'Lhtfl' ) - + call dshr_fldList_add(fldsExport, 'Sa_shum' ) + call dshr_fldList_add(fldsExport, 'Faxa_rain' ) + call dshr_fldList_add(fldsExport, 'Faxa_snow' ) call dshr_fldList_add(fldsExport, 'Faxa_swndr' ) - call dshr_fldList_add(fldsExport, 'Faxa_swndf' ) call dshr_fldList_add(fldsExport, 'Faxa_swvdr' ) + call dshr_fldList_add(fldsExport, 'Faxa_swndf' ) call dshr_fldList_add(fldsExport, 'Faxa_swvdf' ) - !call dshr_fldList_add(fldsExport, 'Ndbsf' ) - !call dshr_fldList_add(fldsExport, 'Nddsf' ) - !call dshr_fldList_add(fldsExport, 'Vbdsf' ) - !call dshr_fldList_add(fldsExport, 'Vddsf' ) - -!not in NEMSdatm - call dshr_fldList_add(fldsExport, 'Sa_wspd' ) - !call dshr_fldList_add(fldsExport, 'Sa_tskn' ) - call dshr_fldList_add(fldsExport, 'Sa_dens' ) - - call dshr_fldList_add(fldsExport, 'Sa_pslv' ) - !call dshr_fldList_add(fldsExport, 'Psurf' ) - -!not in NEMSdatm - !call dshr_fldList_add(fldsExport, 'Faxa_rainc' ) - !call dshr_fldList_add(fldsExport, 'Faxa_rainl' ) - !call dshr_fldList_add(fldsExport, 'Faxa_snowc' ) - - call dshr_fldList_add(fldsExport, 'Faxa_rain' ) - !call dshr_fldList_add(fldsExport, 'Prate' ) - call dshr_fldList_add(fldsExport, 'Faxa_snowl' ) + call dshr_fldList_add(fldsExport, 'Faxa_lwdn' ) fldlist => fldsExport ! the head of the linked list do while (associated(fldlist)) @@ -185,6 +110,9 @@ subroutine datm_datamode_cfsr_init_pointers(exportState, sdat, rc) rc = ESMF_SUCCESS + ! initialize pointers for module level stream arrays + call shr_strdata_get_stream_pointer( sdat, 'Sa_mask' , strm_mask , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! get export state pointers call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -192,27 +120,15 @@ subroutine datm_datamode_cfsr_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_v' , fldptr1=Sa_v , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Sa_wspd' , fldptr1=Sa_wspd , allowNullReturn=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_tbot' , fldptr1=Sa_tbot , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_pbot' , fldptr1=Sa_pbot , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Sa_ptem' , fldptr1=Sa_ptem , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_shum' , fldptr1=Sa_shum , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Sa_dens' , fldptr1=Sa_dens , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_rain' , fldptr1=Faxa_rain , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return -! call dshr_state_getfldptr(exportState, 'Faxa_rainc' , fldptr1=Faxa_rainc , rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! call dshr_state_getfldptr(exportState, 'Faxa_rainl' , fldptr1=Faxa_rainl , rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! call dshr_state_getfldptr(exportState, 'Faxa_snowc' , fldptr1=Faxa_snowc , rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_snowl' , fldptr1=Faxa_snowl , rc=rc) + call dshr_state_getfldptr(exportState, 'Faxa_snow' , fldptr1=Faxa_snow , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_swvdr' , fldptr1=Faxa_swvdr , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -222,22 +138,8 @@ subroutine datm_datamode_cfsr_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_swndf' , fldptr1=Faxa_swndf , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_swnet' , fldptr1=Faxa_swnet , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return -! call dshr_state_getfldptr(exportState, 'Faxa_swdn' , fldptr1=Faxa_swdn , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_lwnet' , fldptr1=Faxa_lwnet , allowNullReturn=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_sen' , fldptr1=Faxa_sen , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_lat' , fldptr1=Faxa_lat , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_taux' , fldptr1=Faxa_taux , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_tauy' , fldptr1=Faxa_tauy , rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine datm_datamode_cfsr_init_pointers @@ -260,55 +162,43 @@ subroutine datm_datamode_cfsr_advance(exportstate, masterproc, logunit, mpicom, integer :: lsize ! size of attr vect real(r8) :: rtmp real(r8) :: tbot, pbot - real(r8) :: vp +! real(r8) :: vp real(r8) :: e, qsat character(len=*), parameter :: subname='(datm_datamode_cfsr_advance): ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS + lsize = size(strm_mask) + if (first_time) then ! determine tbotmax (see below for use) rtmp = maxval(Sa_tbot(:)) call shr_mpi_max(rtmp, tbotmax, mpicom, 'datm_tbot', all=.true.) if (masterproc) write(logunit,*) trim(subname),' tbotmax = ',tbotmax + ! determine maskmax (see below for use) + rtmp = maxval(strm_mask(:)) + call shr_mpi_max(rtmp, maskmax, mpicom, 'datm_mask', all=.true.) + if (masterproc) write(logunit,*) trim(subname),' maskmax = ',maskmax + ! reset first_time first_time = .false. end if do n = 1, lsize - !--- bottom layer height --- - Sa_z(n) = 10.0_r8 - - !--- calculate wind speed --- - if (associated(Sa_wspd)) then - Sa_wspd(n) = sqrt(Sa_u(n)*Sa_u(n)+Sa_v(n)*Sa_v(n)) - end if !--- temperature --- if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz ! Limit very cold forcing to 180K Sa_tbot(n) = max(180._r8, Sa_tbot(n)) - Sa_ptem(n) = Sa_tbot(n) - -! comment out - !--- specific humidity --- - tbot = Sa_tbot(n) - pbot = Sa_pbot(n) - - !--- density --- - vp = (Sa_shum(n)*pbot) / (0.622_r8 + 0.378_r8 * Sa_shum(n)) - Sa_dens(n) = (pbot - 0.378_r8 * vp) / (tbot*rdair) -! comment out - !--- shortwave radiation (Faxa_* basically holds albedo) --- -! Faxa_swvdr(n) = Faxa_swdn(n)*Faxa_swvdr(n) -! Faxa_swndr(n) = Faxa_swdn(n)*Faxa_swndr(n) -! Faxa_swvdf(n) = Faxa_swdn(n)*Faxa_swvdf(n) -! Faxa_swndf(n) = Faxa_swdn(n)*Faxa_swndf(n) -! comment out +! Sa_ptem(n) = Sa_tbot(n) end do + !---------------------------------------------------------- + ! unit conversions (temporal resolution is 6-hourly) + !---------------------------------------------------------- + end subroutine datm_datamode_cfsr_advance !=============================================================================== diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index f4664b341..3dd53e0e9 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -1,6 +1,7 @@ module datm_datamode_clmncep_mod - use ESMF + use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_State, ESMF_StateItem_Flag + use ESMF , only : ESMF_STATEITEM_NOTFOUND, ESMF_LOGMSG_INFO, ESMF_StateGet, operator(/=) use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort @@ -100,7 +101,7 @@ module datm_datamode_clmncep_mod real(r8) , parameter :: stebol = SHR_CONST_STEBOL ! Stefan-Boltzmann constant ~ W/m^2/K^4 real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg - + character(*), parameter :: nullstr = 'null' character(*), parameter :: rpfile = 'rpointer.atm' character(*), parameter :: u_FILE_u = & @@ -302,13 +303,13 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r if (ChkErr(rc,__LINE__,u_FILE_u)) return if (itemflag /= ESMF_STATEITEM_NOTFOUND) then atm_prognostic = .true. - call dshr_state_getfldptr(importState, 'Sx_anidr', fldptr1=Sx_anidr, rc=rc) + call dshr_state_getfldptr(importState, 'Sx_anidr', fldptr1=Sx_anidr, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Sx_anidf', fldptr1=Sx_anidf, rc=rc) + call dshr_state_getfldptr(importState, 'Sx_anidf', fldptr1=Sx_anidf, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Sx_avsdr', fldptr1=Sx_avsdr, rc=rc) + call dshr_state_getfldptr(importState, 'Sx_avsdr', fldptr1=Sx_avsdr, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Sx_avsdf', fldptr1=Sx_avsdf, rc=rc) + call dshr_state_getfldptr(importState, 'Sx_avsdf', fldptr1=Sx_avsdf, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if @@ -490,7 +491,7 @@ subroutine datm_datamode_clmncep_advance(masterproc, logunit, mpicom, rc) ! bias correction / anomaly forcing ( start block ) ! modify atmospheric input fields if streams exist !---------------------------------------------------------- - + ! bias correct precipitation relative to observed ! (via bias_correct nameslist option) if (associated(strm_precsf)) then @@ -541,7 +542,7 @@ end subroutine datm_datamode_clmncep_advance !=============================================================================== subroutine datm_datamode_clmncep_restart_write(case_name, inst_suffix, ymd, tod, & logunit, my_task, sdat) - + ! input/output variables character(len=*) , intent(in) :: case_name character(len=*) , intent(in) :: inst_suffix diff --git a/datm/datm_datamode_core2_mod.F90 b/datm/datm_datamode_core2_mod.F90 index aae90a23e..4bdfa58fd 100644 --- a/datm/datm_datamode_core2_mod.F90 +++ b/datm/datm_datamode_core2_mod.F90 @@ -1,6 +1,19 @@ module datm_datamode_core2_mod - use ESMF + use ESMF , only : ESMF_State, ESMF_Field, ESMF_FieldBundle + use ESMF , only : ESMF_DistGrid, ESMF_RouteHandle, ESMF_MeshCreate + use ESMF , only : ESMF_Mesh, ESMF_MeshGet, ESMF_MeshCreate + use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_FILEFORMAT_ESMFMESH + use ESMF , only : ESMF_FieldBundleCreate, ESMF_FieldCreate, ESMF_MESHLOC_ELEMENT + use ESMF , only : ESMF_FieldBundleAdd, ESMF_LOGMSG_INFO, ESMF_TYPEKIND_R8 + use ESMF , only : ESMF_RouteHandleDestroy, ESMF_EXTRAPMETHOD_NEAREST_STOD + use ESMF , only : ESMF_POLEMETHOD_ALLAVG, ESMF_REGRIDMETHOD_BILINEAR + use ESMF , only : ESMF_DistGridGet, ESMF_FieldRegridStore, ESMF_FieldRedistStore + use pio , only : Var_Desc_t, file_desc_t, io_desc_t, pio_read_darray, pio_freedecomp + use pio , only : pio_openfile, PIO_NOWRITE, pio_seterrorhandling, PIO_BCAST_ERROR + use pio , only : pio_initdecomp, pio_inq_dimlen, pio_inq_varid + use pio , only : pio_inq_varndims, pio_inq_vardimid, pio_double + use pio , only : pio_closefile use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort @@ -11,7 +24,6 @@ module datm_datamode_core2_mod use dshr_mod , only : dshr_restart_read, dshr_restart_write use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add - use pio implicit none private ! except @@ -369,7 +381,7 @@ end subroutine datm_datamode_core2_advance !=============================================================================== subroutine datm_datamode_core2_restart_write(case_name, inst_suffix, ymd, tod, & logunit, my_task, sdat) - + ! input/output variables character(len=*) , intent(in) :: case_name character(len=*) , intent(in) :: inst_suffix @@ -405,7 +417,7 @@ end subroutine datm_datamode_core2_restart_read subroutine datm_get_adjustment_factors(sdat, fileName_mesh, fileName_data, windF, winddF, qsatF, rc) ! input/output variables - type(shr_strdata_type) , intent(in) :: sdat + type(shr_strdata_type) , intent(in) :: sdat character(*) , intent(in) :: fileName_mesh ! file name string character(*) , intent(in) :: fileName_data ! file name string real(R8) , pointer :: windF(:) ! wind adjustment factor diff --git a/datm/datm_datamode_cplhist_mod.F90 b/datm/datm_datamode_cplhist_mod.F90 new file mode 100644 index 000000000..98c1d5cf0 --- /dev/null +++ b/datm/datm_datamode_cplhist_mod.F90 @@ -0,0 +1,234 @@ +module datm_datamode_cplhist_mod + + use ESMF , only : ESMF_SUCCESS, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_State + use ESMF , only : ESMF_StateItem_Flag + use NUOPC , only : NUOPC_Advertise + use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs + use shr_sys_mod , only : shr_sys_abort + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer + use dshr_mod , only : dshr_restart_read, dshr_restart_write + use dshr_strdata_mod , only : shr_strdata_type + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + + implicit none + private ! except + + public :: datm_datamode_cplhist_advertise + public :: datm_datamode_cplhist_init_pointers + public :: datm_datamode_cplhist_advance + public :: datm_datamode_cplhist_restart_write + public :: datm_datamode_cplhist_restart_read + + ! export state data + real(r8), pointer :: Sa_z(:) => null() + real(r8), pointer :: Sa_u(:) => null() + real(r8), pointer :: Sa_v(:) => null() + real(r8), pointer :: Sa_tbot(:) => null() + real(r8), pointer :: Sa_ptem(:) => null() + real(r8), pointer :: Sa_shum(:) => null() + real(r8), pointer :: Sa_shum_wiso(:,:) => null() ! water isotopes + real(r8), pointer :: Sa_dens(:) => null() + real(r8), pointer :: Sa_pbot(:) => null() + real(r8), pointer :: Sa_pslv(:) => null() + real(r8), pointer :: Faxa_lwdn(:) => null() + real(r8), pointer :: Faxa_rainc(:) => null() + real(r8), pointer :: Faxa_rainl(:) => null() + real(r8), pointer :: Faxa_snowc(:) => null() + real(r8), pointer :: Faxa_snowl(:) => null() + real(r8), pointer :: Faxa_swndr(:) => null() + real(r8), pointer :: Faxa_swndf(:) => null() + real(r8), pointer :: Faxa_swvdr(:) => null() + real(r8), pointer :: Faxa_swvdf(:) => null() + real(r8), pointer :: Faxa_swnet(:) => null() + + character(*), parameter :: nullstr = 'null' + character(*), parameter :: rpfile = 'rpointer.atm' + character(*), parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine datm_datamode_cplhist_advertise(exportState, fldsexport, flds_scalar_name, & + flds_co2, flds_wiso, presaero, rc) + + ! input/output variables + type(esmf_State) , intent(inout) :: exportState + type(fldlist_type) , pointer :: fldsexport + logical , intent(in) :: flds_co2 + logical , intent(in) :: flds_wiso + logical , intent(in) :: presaero + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(out) :: rc + + ! local variables + type(fldlist_type), pointer :: fldList + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) + call dshr_fldList_add(fldsExport, 'Sa_topo' ) + call dshr_fldList_add(fldsExport, 'Sa_z' ) + call dshr_fldList_add(fldsExport, 'Sa_u' ) + call dshr_fldList_add(fldsExport, 'Sa_v' ) + call dshr_fldList_add(fldsExport, 'Sa_ptem' ) + call dshr_fldList_add(fldsExport, 'Sa_dens' ) + call dshr_fldList_add(fldsExport, 'Sa_pslv' ) + call dshr_fldList_add(fldsExport, 'Sa_tbot' ) + call dshr_fldList_add(fldsExport, 'Sa_pbot' ) + call dshr_fldList_add(fldsExport, 'Sa_shum' ) + call dshr_fldList_add(fldsExport, 'Faxa_rainc' ) + call dshr_fldList_add(fldsExport, 'Faxa_rainl' ) + call dshr_fldList_add(fldsExport, 'Faxa_snowc' ) + call dshr_fldList_add(fldsExport, 'Faxa_snowl' ) + call dshr_fldList_add(fldsExport, 'Faxa_swndr' ) + call dshr_fldList_add(fldsExport, 'Faxa_swvdr' ) + call dshr_fldList_add(fldsExport, 'Faxa_swndf' ) + call dshr_fldList_add(fldsExport, 'Faxa_swvdf' ) + call dshr_fldList_add(fldsExport, 'Faxa_swnet' ) + call dshr_fldList_add(fldsExport, 'Faxa_lwdn' ) + call dshr_fldList_add(fldsExport, 'Faxa_swdn' ) + if (flds_co2) then + call dshr_fldList_add(fldsExport, 'Sa_co2prog') + call dshr_fldList_add(fldsExport, 'Sa_co2diag') + end if + if (presaero) then + call dshr_fldList_add(fldsExport, 'Faxa_bcph' , ungridded_lbound=1, ungridded_ubound=3) + call dshr_fldList_add(fldsExport, 'Faxa_ocph' , ungridded_lbound=1, ungridded_ubound=3) + call dshr_fldList_add(fldsExport, 'Faxa_dstwet' , ungridded_lbound=1, ungridded_ubound=4) + call dshr_fldList_add(fldsExport, 'Faxa_dstdry' , ungridded_lbound=1, ungridded_ubound=4) + end if + if (flds_wiso) then + call dshr_fldList_add(fldsExport, 'Faxa_rainc_wiso', ungridded_lbound=1, ungridded_ubound=3) + call dshr_fldList_add(fldsExport, 'Faxa_rainl_wiso', ungridded_lbound=1, ungridded_ubound=3) + call dshr_fldList_add(fldsExport, 'Faxa_snowc_wiso', ungridded_lbound=1, ungridded_ubound=3) + call dshr_fldList_add(fldsExport, 'Faxa_snowl_wiso', ungridded_lbound=1, ungridded_ubound=3) + call dshr_fldList_add(fldsExport, 'Faxa_shum_wiso' , ungridded_lbound=1, ungridded_ubound=3) + end if + + fldlist => fldsExport ! the head of the linked list + do while (associated(fldlist)) + call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite('(datm_comp_advertise): Fr_atm'//trim(fldList%stdname), ESMF_LOGMSG_INFO) + fldList => fldList%next + enddo + + end subroutine datm_datamode_cplhist_advertise + + !=============================================================================== + subroutine datm_datamode_cplhist_init_pointers(importState, exportState, sdat, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: importState + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + integer , intent(out) :: rc + + ! local variables + type(ESMF_StateItem_Flag) :: itemFlag + character(len=*), parameter :: subname='(datm_init_pointers): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! get export state pointers + call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_v' , fldptr1=Sa_v , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_tbot' , fldptr1=Sa_tbot , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_pbot' , fldptr1=Sa_pbot , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_pslv' , fldptr1=Sa_pslv , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_ptem' , fldptr1=Sa_ptem , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_shum' , fldptr1=Sa_shum , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_dens' , fldptr1=Sa_dens , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_rainc' , fldptr1=Faxa_rainc , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_rainl' , fldptr1=Faxa_rainl , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_snowc' , fldptr1=Faxa_snowc , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_snowl' , fldptr1=Faxa_snowl , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swvdr' , fldptr1=Faxa_swvdr , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swvdf' , fldptr1=Faxa_swvdf , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swndr' , fldptr1=Faxa_swndr , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swndf' , fldptr1=Faxa_swndf , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swnet' , fldptr1=Faxa_swnet , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end subroutine datm_datamode_cplhist_init_pointers + + !=============================================================================== + subroutine datm_datamode_cplhist_advance(masterproc, logunit, mpicom, rc) + + ! input/output variables + logical , intent(in) :: masterproc + integer , intent(in) :: logunit + integer , intent(in) :: mpicom + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(datm_datamode_cplhist_advance): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! For now - do nothing special + + end subroutine datm_datamode_cplhist_advance + + !=============================================================================== + subroutine datm_datamode_cplhist_restart_write(case_name, inst_suffix, ymd, tod, & + logunit, my_task, sdat) + + ! input/output variables + character(len=*) , intent(in) :: case_name + character(len=*) , intent(in) :: inst_suffix + integer , intent(in) :: ymd ! model date + integer , intent(in) :: tod ! model sec into model date + integer , intent(in) :: logunit + integer , intent(in) :: my_task + type(shr_strdata_type) , intent(inout) :: sdat + !------------------------------------------------------------------------------- + + call dshr_restart_write(rpfile, case_name, 'datm', inst_suffix, ymd, tod, & + logunit, my_task, sdat) + + end subroutine datm_datamode_cplhist_restart_write + + !=============================================================================== + subroutine datm_datamode_cplhist_restart_read(rest_filem, inst_suffix, logunit, my_task, mpicom, sdat) + + ! input/output arguments + character(len=*) , intent(inout) :: rest_filem + character(len=*) , intent(in) :: inst_suffix + integer , intent(in) :: logunit + integer , intent(in) :: my_task + integer , intent(in) :: mpicom + type(shr_strdata_type) , intent(inout) :: sdat + !------------------------------------------------------------------------------- + + call dshr_restart_read(rest_filem, rpfile, inst_suffix, nullstr, logunit, my_task, mpicom, sdat) + + end subroutine datm_datamode_cplhist_restart_read + +end module datm_datamode_cplhist_mod diff --git a/datm/datm_datamode_era5_mod.F90 b/datm/datm_datamode_era5_mod.F90 index 30f4a49ff..71e60a016 100644 --- a/datm/datm_datamode_era5_mod.F90 +++ b/datm/datm_datamode_era5_mod.F90 @@ -1,6 +1,6 @@ module datm_datamode_era5_mod - use ESMF + use ESMF , only : ESMF_State, ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort @@ -60,7 +60,7 @@ module datm_datamode_era5_mod real(r8) , parameter :: tKFrz = SHR_CONST_TKFRZ real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg real(r8) , parameter :: rhofw = SHR_CONST_RHOFW ! density of fresh water ~ kg/m^3 - + character(*), parameter :: nullstr = 'undefined' character(*), parameter :: rpfile = 'rpointer.atm' character(*), parameter :: u_FILE_u = & @@ -248,7 +248,7 @@ subroutine datm_datamode_era5_advance(exportstate, masterproc, logunit, mpicom, !--- calculate wind speed --- if (associated(Sa_wspd)) then - Sa_wspd(n) = sqrt(Sa_u(n)*Sa_u(n)+Sa_v(n)*Sa_v(n)) + Sa_wspd(n) = sqrt(Sa_u(n)*Sa_u(n)+Sa_v(n)*Sa_v(n)) end if !--- temperature --- @@ -316,7 +316,7 @@ end subroutine datm_datamode_era5_advance !=============================================================================== subroutine datm_datamode_era5_restart_write(case_name, inst_suffix, ymd, tod, & logunit, my_task, sdat) - + ! input/output variables character(len=*) , intent(in) :: case_name character(len=*) , intent(in) :: inst_suffix diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index 653e9251b..7f7815d04 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -1,6 +1,7 @@ module datm_datamode_jra_mod - use ESMF + use ESMF , only : ESMF_State, ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_MeshGet use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort @@ -11,7 +12,6 @@ module datm_datamode_jra_mod use dshr_mod , only : dshr_restart_read, dshr_restart_write use dshr_strdata_mod , only : shr_strdata_type use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add - use pio implicit none private ! except @@ -223,7 +223,7 @@ subroutine datm_datamode_jra_advance(exportstate, target_ymd, target_tod, model_ Sa_pbot(n) = Sa_pslv(n) Sa_ptem(n) = Sa_tbot(n) - ! density computation for JRA55 forcing + ! density computation for JRA55 forcing Sa_dens(n) = Sa_pbot(n)/(rdair*Sa_tbot(n)*(1 + 0.608*Sa_shum(n))) ! precipitation data @@ -253,7 +253,7 @@ end subroutine datm_datamode_jra_advance !=============================================================================== subroutine datm_datamode_jra_restart_write(case_name, inst_suffix, ymd, tod, & logunit, my_task, sdat) - + ! input/output variables character(len=*) , intent(in) :: case_name character(len=*) , intent(in) :: inst_suffix diff --git a/dice/CMakeLists.txt b/dice/CMakeLists.txt index f45a446b3..bd24a640b 100644 --- a/dice/CMakeLists.txt +++ b/dice/CMakeLists.txt @@ -10,11 +10,15 @@ foreach(FILE ${SRCFILES}) message("Using ${FILE} from ${CASEROOT}/SourceMods/src.dice") endif() endforeach() + +message("DICE srcfiles are ${SRCFILES}") + add_library(dice ${SRCFILES}) -target_include_directories (dice PUBLIC ${ESMF_F90COMPILEPATHS}) -target_include_directories (dice PUBLIC "${CMAKE_BINARY_DIR}/dshr") -target_include_directories (dice PUBLIC "${CMAKE_SOURCE_DIR}") -target_include_directories (dice PUBLIC "${CMAKE_BINARY_DIR}/share") -target_include_directories (dice PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (dice PUBLIC "${PIO_Fortran_INCLUDE_DIR}") +add_dependencies(dice dshr streams) +target_include_directories (dice PRIVATE ${ESMF_F90COMPILEPATHS}) +target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (dice PRIVATE "${CMAKE_SOURCE_DIR}") +target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") +target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (dice PRIVATE "${PIO_Fortran_INCLUDE_DIR}") diff --git a/dice/dice_datamode_ssmi_mod.F90 b/dice/dice_datamode_ssmi_mod.F90 index 090c4f10c..f48244bb7 100644 --- a/dice/dice_datamode_ssmi_mod.F90 +++ b/dice/dice_datamode_ssmi_mod.F90 @@ -1,6 +1,8 @@ module dice_datamode_ssmi_mod - use ESMF + use ESMF , only : ESMF_State, ESMF_LogWrite, ESMF_Array, ESMF_MeshGet + use ESMF , only : ESMF_SUCCESS, ESMF_LOGMSG_INFO, ESMF_DistGrid + use ESMF , only : ESMF_ArrayCreate, ESMF_ArrayDestroy use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort @@ -12,7 +14,6 @@ module dice_datamode_ssmi_mod use dshr_mod , only : dshr_restart_read, dshr_restart_write use dice_flux_atmice_mod , only : dice_flux_atmice use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add - use pio implicit none private ! except diff --git a/dice/dice_flux_atmice_mod.F90 b/dice/dice_flux_atmice_mod.F90 index e4d17caec..4d660765b 100644 --- a/dice/dice_flux_atmice_mod.F90 +++ b/dice/dice_flux_atmice_mod.F90 @@ -1,20 +1,14 @@ module dice_flux_atmice_mod use shr_kind_mod, only : r8=>shr_kind_r8, cxx=>shr_kind_cxx, cl=>shr_kind_cl, cs=>shr_kind_cs - use shr_const_mod ! shared constants - use shr_sys_mod ! shared system routines - + ! shared constants + use shr_const_mod, only : loc_zvir => shr_const_zvir, loc_cpdair => shr_const_cpdair + use shr_const_mod, only : loc_cpvir => shr_const_cpvir, loc_karman => shr_const_karman + use shr_const_mod, only : loc_g => shr_const_g, loc_latvap => shr_const_latvap + use shr_const_mod, only : loc_latice => shr_const_latice, loc_stebol => shr_const_stebol + use shr_const_mod, only : spval => shr_const_spval implicit none - real(R8) :: loc_zvir = shr_const_zvir - real(R8) :: loc_cpdair = shr_const_cpdair - real(R8) :: loc_cpvir = shr_const_cpvir - real(R8) :: loc_karman = shr_const_karman - real(R8) :: loc_g = shr_const_g - real(R8) :: loc_latvap = shr_const_latvap - real(R8) :: loc_latice = shr_const_latice - real(R8) :: loc_stebol = shr_const_stebol - integer,parameter :: dbug = 0 ! internal debug level !=============================================================================== @@ -68,7 +62,6 @@ subroutine dice_flux_atmice( & real(R8),parameter :: umin = 1.0_R8 ! minimum wind speed (m/s) real(R8),parameter :: zref = 10.0_R8 ! ref height ~ m real(R8),parameter :: ztref = 2.0_R8 ! ref height for air T ~ m - real(R8),parameter :: spval = shr_const_spval ! special value real(R8),parameter :: zzsice = 0.0005_R8 ! ice surface roughness !--- local variables -------------------------------- diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index 05ede8161..de243e597 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -4,7 +4,14 @@ module ice_comp_nuopc ! This is the NUOPC cap for DICE !---------------------------------------------------------------------------- - use ESMF + use ESMF , only : ESMF_Mesh, ESMF_GridComp, ESMF_State, ESMF_Clock + use ESMF , only : ESMF_SUCCESS, ESMF_Time, ESMF_LogWrite, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit + use ESMF , only : ESMF_Alarm, ESMF_TimeInterval, ESMF_TimeIntervalGet + use ESMF , only : ESMF_AlarmIsRinging, ESMF_METHOD_INITIALIZE + use ESMF , only : ESMF_ClockGet, ESMF_TimeGet, ESMF_MethodRemove, ESMF_MethodAdd + use ESMF , only : ESMF_GridCompSetEntryPoint, operator(+), ESMF_AlarmRingerOff + use ESMF , only : ESMF_ClockGetAlarm use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise use NUOPC_Model , only : model_routine_SS => SetServices diff --git a/dlnd/CMakeLists.txt b/dlnd/CMakeLists.txt index ae080d307..92c20be7d 100644 --- a/dlnd/CMakeLists.txt +++ b/dlnd/CMakeLists.txt @@ -9,11 +9,14 @@ foreach(FILE ${SRCFILES}) endif() endforeach() +message("DLND srcfiles are ${SRCFILES}") + add_library(dlnd ${SRCFILES}) -target_include_directories (dlnd PUBLIC ${ESMF_F90COMPILEPATHS}) -target_include_directories (dlnd PUBLIC "${CMAKE_BINARY_DIR}/dshr") -target_include_directories (dlnd PUBLIC "${CMAKE_SOURCE_DIR}") -target_include_directories (dlnd PUBLIC "${CMAKE_BINARY_DIR}/share") -target_include_directories (dlnd PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (dlnd PUBLIC "${PIO_Fortran_INCLUDE_DIR}") +add_dependencies(dlnd dshr streams) +target_include_directories (dlnd PRIVATE ${ESMF_F90COMPILEPATHS}) +target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (dlnd PRIVATE "${CMAKE_SOURCE_DIR}") +target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") +target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (dlnd PRIVATE "${PIO_Fortran_INCLUDE_DIR}") diff --git a/dlnd/cime_config/buildnml b/dlnd/cime_config/buildnml index 998959374..e6176e3bd 100755 --- a/dlnd/cime_config/buildnml +++ b/dlnd/cime_config/buildnml @@ -61,7 +61,6 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config = {} config['dlnd_mode'] = dlnd_mode config['create_mesh'] = 'true' if case.get_value("LND_DOMAIN_MESH") == 'create_mesh' else 'false' - config['set_model_maskfile'] = 'true' if dlnd_mode == 'SCPL' or dlnd_mode == 'LCPL' else 'false' # Do not allow single column mode for drof scol_mode = True if case.get_value('PTS_MODE') else False diff --git a/dlnd/cime_config/namelist_definition_dlnd.xml b/dlnd/cime_config/namelist_definition_dlnd.xml index 954dd84f6..0072c3662 100644 --- a/dlnd/cime_config/namelist_definition_dlnd.xml +++ b/dlnd/cime_config/namelist_definition_dlnd.xml @@ -56,11 +56,10 @@ abs dlnd_nml - file specifying model mask if not obtained from input model mesh + file specifying file to use to obtain model mask - $LND_DOMAIN_MESH - $LND_DOMAIN_PATH/$LND_DOMAIN_FILE + $MASK_MESH diff --git a/dlnd/lnd_comp_nuopc.F90 b/dlnd/lnd_comp_nuopc.F90 index ad9455ff3..566b80441 100644 --- a/dlnd/lnd_comp_nuopc.F90 +++ b/dlnd/lnd_comp_nuopc.F90 @@ -4,7 +4,13 @@ module lnd_comp_nuopc ! This is the NUOPC cap for DLND !---------------------------------------------------------------------------- - use ESMF + use ESMF , only : ESMF_Mesh, ESMF_GridComp, ESMF_SUCCESS, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_LogWrite, ESMF_TraceRegionExit, ESMF_TraceRegionEnter + use ESMF , only : ESMF_Clock, ESMF_Alarm, ESMF_State, ESMF_ClockGet, ESMF_timeGet + use ESMF , only : ESMF_Time, ESMF_TimeInterval, ESMF_METHOD_INITIALIZE + use ESMF , only : ESMF_MethodAdd, ESMF_MethodRemove + use ESMF , only : ESMF_ClockGetAlarm, ESMF_AlarmIsRinging, ESMF_AlarmRingerOff + use ESMF , only : ESMF_GridCompSetEntryPoint, operator(+) use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise use NUOPC_Model , only : model_routine_SS => SetServices @@ -206,7 +212,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logunit,F00)' model_maskfile = ',trim(model_maskfile) end if write(logunit ,*)' datamode = ',datamode - write(logunit ,*)' model_meshfile = ',trim(model_meshfile) write(logunit ,*)' nx_global = ',nx_global write(logunit ,*)' ny_global = ',ny_global write(logunit ,*)' restfilm = ',trim(restfilm) diff --git a/docn/CMakeLists.txt b/docn/CMakeLists.txt index 33e3ba01c..71c011478 100644 --- a/docn/CMakeLists.txt +++ b/docn/CMakeLists.txt @@ -13,12 +13,14 @@ foreach(FILE ${SRCFILES}) endif() endforeach() -add_library(docn ${SRCFILES}) +message("DOCN srcfiles are ${SRCFILES}") +add_library(docn ${SRCFILES}) -target_include_directories (docn PUBLIC ${ESMF_F90COMPILEPATHS}) -target_include_directories (docn PUBLIC "${CMAKE_BINARY_DIR}/dshr") -target_include_directories (docn PUBLIC "${CMAKE_SOURCE_DIR}") -target_include_directories (docn PUBLIC "${CMAKE_BINARY_DIR}/share") -target_include_directories (docn PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (docn PUBLIC "${PIO_Fortran_INCLUDE_DIR}") +add_dependencies(docn dshr streams) +target_include_directories (docn PRIVATE ${ESMF_F90COMPILEPATHS}) +target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/dshr) +target_include_directories (docn PRIVATE ${CMAKE_SOURCE_DIR}) +target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) +target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/streams) +target_include_directories (docn PRIVATE ${PIO_Fortran_INCLUDE_DIR}) diff --git a/docn/cime_config/buildnml b/docn/cime_config/buildnml index aeb97f895..e76b8d0c1 100755 --- a/docn/cime_config/buildnml +++ b/docn/cime_config/buildnml @@ -52,6 +52,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path atm_nx = case.get_value("ATM_NX") atm_ny = case.get_value("ATM_NY") model_grid = case.get_value("GRID") + mask_grid = case.get_value('MASK_GRID') # Check for incompatible options. expect(ocn_grid != "null", @@ -67,9 +68,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['ocn_grid'] = ocn_grid config['docn_mode'] = docn_mode config['create_mesh'] = 'true' if case.get_value("OCN_DOMAIN_MESH") == 'create_mesh' else 'false' - aquaplanet_mode = True if 'AQ' in case.get_value('COMPSET') else False + config['aqua_planet'] = 'true' if 'aquap' in docn_mode else 'false' scol_mode = True if case.get_value('PTS_MODE') else False - config['set_model_maskfile'] = 'true' if scol_mode or (ocn_nx==atm_nx and ocn_ny==atm_ny and not aquaplanet_mode) else 'false' nmlgen.init_defaults(infile, config) @@ -85,7 +85,6 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path #endif if generate_stream_file: streamlist = nmlgen.get_streams() - print "DEBUG: streamlist is ",streamlist stream_file = os.path.join(_CDEPS_CONFIG,os.pardir, "docn","cime_config","stream_definition_docn.xml") schema_file = os.path.join(_CDEPS_CONFIG,"streams_v2.0.xsd") streams = StreamCDEPS(stream_file, schema_file) diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index 77ce5ad2d..cd7af94c0 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -124,19 +124,17 @@ - + char streams abs docn_nml - file specifying model mask if not obtained from input model mesh + MESH for ocn mask - $OCN_DOMAIN_MESH - $OCN_DOMAIN_PATH/$OCN_DOMAIN_FILE - $OCN_DOMAIN_PATH/$OCN_DOMAIN_FILE - $OCN_DOMAIN_PATH/$OCN_DOMAIN_FILE + $MASK_MESH + $ATM_DOMAIN_MESH diff --git a/docn/docn_datamode_aquaplanet_mod.F90 b/docn/docn_datamode_aquaplanet_mod.F90 index e687d8d85..e851e6d31 100644 --- a/docn/docn_datamode_aquaplanet_mod.F90 +++ b/docn/docn_datamode_aquaplanet_mod.F90 @@ -1,6 +1,6 @@ module docn_datamode_aquaplanet_mod - use ESMF + use ESMF , only : ESMF_SUCCESS, ESMF_State, ESMF_Mesh, ESMF_MeshGet, ESMF_LogWrite, ESMF_LOGMSG_INFO use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_const_mod , only : shr_const_TkFrz, shr_const_pi @@ -22,7 +22,7 @@ module docn_datamode_aquaplanet_mod real(r8), pointer :: So_v(:) => null() ! model mesh lats and lons in radians - real(r8), pointer :: rlon(:), rlat(:) + real(r8), pointer :: rlon(:), rlat(:) ! parameters real(r8) , parameter :: tkfrz = shr_const_tkfrz ! freezing point, fresh water (kelvin) diff --git a/docn/docn_datamode_copyall_mod.F90 b/docn/docn_datamode_copyall_mod.F90 index 08fb4600f..95d4b7642 100644 --- a/docn/docn_datamode_copyall_mod.F90 +++ b/docn/docn_datamode_copyall_mod.F90 @@ -1,6 +1,6 @@ module docn_datamode_copyall_mod - use ESMF + use ESMF , only : ESMF_State, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_SUCCESS use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_const_mod , only : shr_const_TkFrz, shr_const_pi, shr_const_ocn_ref_sal @@ -89,16 +89,22 @@ subroutine docn_datamode_copyall_init_pointers(exportState, ocn_fraction, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'So_t' , fldptr1=So_t , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_s' , fldptr1=So_s , rc=rc) + call dshr_state_getfldptr(exportState, 'So_s' , fldptr1=So_s , allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_u' , fldptr1=So_u , rc=rc) + call dshr_state_getfldptr(exportState, 'So_u' , fldptr1=So_u , allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'So_v' , fldptr1=So_v , rc=rc) + call dshr_state_getfldptr(exportState, 'So_v' , fldptr1=So_v , allowNullReturn=.true., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - So_u(:) = 0.0_r8 - So_v(:) = 0.0_r8 - So_s(:) = ocnsalt + if (associated(So_u)) then + So_u(:) = 0.0_r8 + end if + if (associated(So_v)) then + So_v(:) = 0.0_r8 + end if + if (associated(So_s)) then + So_s(:) = ocnsalt + end if So_t(:) = TkFrz ! Set export state ocean fraction (So_omask) @@ -125,7 +131,7 @@ end subroutine docn_datamode_copyall_advance !=============================================================================== subroutine docn_datamode_copyall_restart_write(case_name, inst_suffix, ymd, tod, & logunit, my_task, sdat) - + ! input/output variables character(len=*) , intent(in) :: case_name character(len=*) , intent(in) :: inst_suffix diff --git a/docn/docn_datamode_iaf_mod.F90 b/docn/docn_datamode_iaf_mod.F90 index 6edc5e087..032467f35 100644 --- a/docn/docn_datamode_iaf_mod.F90 +++ b/docn/docn_datamode_iaf_mod.F90 @@ -1,6 +1,6 @@ module docn_datamode_iaf_mod - use ESMF + use ESMF , only : ESMF_SUCCESS, ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_State use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort @@ -179,7 +179,7 @@ end subroutine docn_datamode_iaf_advance !=============================================================================== subroutine docn_datamode_iaf_restart_write(case_name, inst_suffix, ymd, tod, & logunit, my_task, sdat) - + ! write restart file ! input/output variables diff --git a/docn/docn_datamode_som_mod.F90 b/docn/docn_datamode_som_mod.F90 index c73a4434d..790990fa6 100644 --- a/docn/docn_datamode_som_mod.F90 +++ b/docn/docn_datamode_som_mod.F90 @@ -1,6 +1,9 @@ module docn_datamode_som_mod - use ESMF + use ESMF , only : ESMF_SUCCESS, ESMF_State, ESMF_Clock, ESMF_StateGet, ESMF_StateItem_Flag + use ESMF , only : ESMF_TimeInterval, ESMF_ClockGet, ESMF_TimeIntervalGet + use ESMF , only : ESMF_LOGMSG_INFO, ESMF_STATEITEM_NOTFOUND, operator(/=) + use ESMF , only : ESMF_LogWrite use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort @@ -14,7 +17,6 @@ module docn_datamode_som_mod use dshr_strdata_mod , only : shr_strdata_type use dshr_mod , only : dshr_restart_read, dshr_restart_write use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add - use pio implicit none private ! except @@ -193,7 +195,7 @@ subroutine docn_datamode_som_init_pointers(importState, exportState, sdat, ocn_f call dshr_state_getfldptr(exportState, 'Fioo_q' , fldptr1=Fioo_q , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - ! For So_fswpen is only needed for diurnal cycle calculation of atm/ocn fluxes + ! For So_fswpen is only needed for diurnal cycle calculation of atm/ocn fluxes ! Currently this is not implemented in cmeps call ESMF_StateGet(exportState, 'So_fswpen', itemFlag, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -221,7 +223,7 @@ subroutine docn_datamode_som_advance(importState, exportState, clock, restart_re ! input/output variables type(ESMF_State) , intent(inout) :: importState type(ESMF_State) , intent(inout) :: exportState - type(ESMF_Clock) , intent(in) :: clock + type(ESMF_Clock) , intent(in) :: clock logical , intent(in) :: restart_read character(len=*) , intent(in) :: datamode integer , intent(out) :: rc @@ -278,7 +280,7 @@ subroutine docn_datamode_som_advance(importState, exportState, clock, restart_re ! compute ice formed or melt potential Fioo_q(n) = (tfreeze(n) - So_t(n))*(cpsw*rhosw*strm_h(n))/dt ! ice formed q>0 - + ! reset temp if (reset_temp) then So_t(n) = max(tfreeze(n),So_t(n)) @@ -299,7 +301,7 @@ end subroutine docn_datamode_som_advance !=============================================================================== subroutine docn_datamode_som_restart_write(case_name, inst_suffix, ymd, tod, & logunit, my_task, sdat) - + ! write restart file ! input/output variables diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 60ba6ba1a..6a73b1043 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -4,7 +4,13 @@ module ocn_comp_nuopc ! This is the NUOPC cap for DOCN !---------------------------------------------------------------------------- - use ESMF + use ESMF , only : ESMF_Mesh, ESMF_GridComp, ESMF_State, ESMF_Clock, ESMF_Time + use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_METHOD_INITIALIZE + use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit, ESMF_ClockGet + use ESMF , only : ESMF_TimeGet, ESMF_TimeInterval, ESMF_Field, ESMF_MAXSTR + use ESMF , only : ESMF_Alarm, ESMF_MethodRemove, ESMF_MethodAdd + use ESMF , only : ESMF_GridCompSetEntryPoint, ESMF_ClockGetAlarm, ESMF_AlarmIsRinging + use ESMF , only : ESMF_StateGet, operator(+), ESMF_AlarmRingerOff, ESMF_LogWrite use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize use NUOPC , only : NUOPC_Advertise, NUOPC_CompAttributeGet use NUOPC_Model , only : model_routine_SS => SetServices diff --git a/drof/CMakeLists.txt b/drof/CMakeLists.txt index 62a92cb83..50bbb20f1 100644 --- a/drof/CMakeLists.txt +++ b/drof/CMakeLists.txt @@ -9,11 +9,14 @@ foreach(FILE ${SRCFILES}) endif() endforeach() +message("DROF srcfiles are ${SRCFILES}") + add_library(drof ${SRCFILES}) -target_include_directories (drof PUBLIC ${ESMF_F90COMPILEPATHS}) -target_include_directories (drof PUBLIC "${CMAKE_BINARY_DIR}/dshr") -target_include_directories (drof PUBLIC "${CMAKE_SOURCE_DIR}") -target_include_directories (drof PUBLIC "${CMAKE_BINARY_DIR}/share") -target_include_directories (drof PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (drof PUBLIC "${PIO_Fortran_INCLUDE_DIR}") +add_dependencies(drof dshr streams) +target_include_directories (drof PRIVATE ${ESMF_F90COMPILEPATHS}) +target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (drof PRIVATE "${CMAKE_SOURCE_DIR}") +target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") +target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (drof PRIVATE "${PIO_Fortran_INCLUDE_DIR}") diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index 529409cc8..aef47ee01 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -4,7 +4,13 @@ module rof_comp_nuopc ! This is the NUOPC cap for DROF !---------------------------------------------------------------------------- - use ESMF + use ESMF , only : ESMF_Mesh, ESMF_GridComp, ESMF_Time, ESMF_TimeInterval + use ESMF , only : ESMF_State, ESMF_Clock, ESMF_SUCCESS, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit + use ESMF , only : ESMF_Alarm, ESMF_METHOD_INITIALIZE, ESMF_MethodAdd, ESMF_MethodRemove + use ESMF , only : ESMF_TimeGet, ESMF_ClockGet, ESMF_GridCompSetEntryPoint + use ESMF , only : ESMF_ClockGetAlarm, ESMF_AlarmIsRinging, ESMF_AlarmRingerOff + use ESMF , only : operator(+), ESMF_LogWrite use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise use NUOPC_Model , only : model_routine_SS => SetServices diff --git a/dshr/CMakeLists.txt b/dshr/CMakeLists.txt index bf4f02553..05f94b901 100644 --- a/dshr/CMakeLists.txt +++ b/dshr/CMakeLists.txt @@ -1,10 +1,10 @@ project(dshr Fortran) + set(SRCFILES dshr_dfield_mod.F90 dshr_fldlist_mod.F90 dshr_mod.F90) -set(MODFILES ${SRCFILES}) + foreach(FILE ${SRCFILES}) - list(TRANSFORM MODFILES REPLACE ".F90" ".mod") if(EXISTS "${CASEROOT}/SourceMods/src.cdeps/${FILE}") list(REMOVE_ITEM SRCFILES ${FILE}) list(APPEND SRCFILES "${CASEROOT}/SourceMods/src.cdeps/${FILE}") @@ -18,12 +18,10 @@ if(BLD_STANDALONE) endif() add_dependencies(dshr streams) -target_include_directories (dshr PUBLIC ${ESMF_F90COMPILEPATHS}) -target_include_directories (dshr PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (dshr PUBLIC "${CMAKE_BINARY_DIR}/share") -target_include_directories (dshr PUBLIC "${PIO_Fortran_INCLUDE_DIR}") +target_include_directories (dshr PRIVATE ${ESMF_F90COMPILEPATHS}) +target_include_directories (dshr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/streams) +target_include_directories (dshr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) +target_include_directories (dshr PRIVATE "${PIO_Fortran_INCLUDE_DIR}") + install(TARGETS dshr - LIBRARY DESTINATION lib) -foreach(MOD ${MODFILES}) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${MOD}" DESTINATION include) -endforeach() + LIBRARY DESTINATION lib) \ No newline at end of file diff --git a/dshr/dshr_dfield_mod.F90 b/dshr/dshr_dfield_mod.F90 index 54bf02147..cc65ebef3 100644 --- a/dshr/dshr_dfield_mod.F90 +++ b/dshr/dshr_dfield_mod.F90 @@ -1,6 +1,7 @@ module dshr_dfield_mod - use ESMF + use ESMF , only : ESMF_State, ESMF_FieldBundle, ESMF_MAXSTR, ESMF_SUCCESS + use ESMF , only : ESMF_FieldBundleGet, ESMF_ITEMORDER_ADDORDER, ESMF_Field use shr_kind_mod , only : r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl, cxx=>shr_kind_cxx use shr_sys_mod , only : shr_sys_abort use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_count, shr_strdata_get_stream_fieldbundle @@ -120,7 +121,7 @@ subroutine dshr_dfield_add_1d(dfields, sdat, state_fld, strm_fld, state, logunit end if end subroutine dshr_dfield_add_1d - + !=============================================================================== subroutine dshr_dfield_add_1d_stateptr(dfields, sdat, state_fld, strm_fld, state, state_ptr, logunit, masterproc, rc) diff --git a/dshr/dshr_fldlist_mod.F90 b/dshr/dshr_fldlist_mod.F90 index 0edab9cee..11b0ab5e3 100644 --- a/dshr/dshr_fldlist_mod.F90 +++ b/dshr/dshr_fldlist_mod.F90 @@ -1,7 +1,11 @@ module dshr_fldlist_mod - use NUOPC - use ESMF + use NUOPC , only : NUOPC_IsConnected, NUOPC_Realize + use ESMF , only : ESMF_State, ESMF_Mesh, ESMF_Field, ESMF_Grid, ESMF_GridCreate + use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_LOGERR_PASSTHRU, ESMF_LogFoundError + use ESMF , only : ESMF_MESHLOC_ELEMENT, ESMF_TYPEKIND_R8, ESMF_StateRemove + use ESMF , only : ESMF_Distgrid, ESMF_DistGridCreate, ESMF_FieldCreate use shr_kind_mod , only : r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl, cxx=>shr_kind_cxx use dshr_methods_mod , only : chkerr diff --git a/dshr/dshr_mod.F90 b/dshr/dshr_mod.F90 index 4dcd96482..eec384601 100644 --- a/dshr/dshr_mod.F90 +++ b/dshr/dshr_mod.F90 @@ -273,7 +273,8 @@ subroutine dshr_mesh_init(gcomp, nullstr, logunit, compname, model_nxg, model_ny ! (1) if asked to create the mesh ! - create mesh from input file given by model_createmesh_fromfile ! - if single column find the nearest neighbor in model_createmesh_fromfile - ! (2) if not single column - obtain the mesh directly from the mesh input + ! (2) if not single column - obtain the mesh directly from the mesh input + ! - reset the model mesh if the model maskfile is not equal to the model mesh file if (trim(model_meshfile) == nullstr) then @@ -319,7 +320,7 @@ subroutine dshr_mesh_init(gcomp, nullstr, logunit, compname, model_nxg, model_ny scol_lat = shr_const_spval end if - ! Now create the model meshfile using the model_maskfile as the input file + ! Now create the model meshfile call dshr_mesh_create(trim(model_createmesh_fromfile), scol_mode, scol_lon, scol_lat, & trim(compname), my_task, logunit, model_mesh, model_mask, model_frac, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -330,61 +331,20 @@ subroutine dshr_mesh_init(gcomp, nullstr, logunit, compname, model_nxg, model_ny model_mesh = ESMF_MeshCreate(trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! TODO: need a check that the mask file has the same grid as the model mesh ! Reset the model mesh mask if the mask file is different from the mesh file if (trim(model_meshfile) /= trim(model_maskfile)) then - pio_subsystem => shr_pio_getiosys(trim(compname)) - io_type = shr_pio_getiotype(trim(compname)) - io_format = shr_pio_getioformat(trim(compname)) - - ! obtain lsize and model_gindex - call ESMF_MeshGet(model_mesh, elementdistGrid=distGrid, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_DistGridGet(distGrid, localDe=0, elementCount=lsize, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! allocate memory for model_mask and model_frac - allocate(model_frac(lsize)) - allocate(model_mask(lsize)) - - ! get model_gindex (allocate memory first) - allocate(model_gindex(lsize)) - call ESMF_DistGridGet(distGrid, localDe=0, seqIndexList=model_gindex, rc=rc) + ! obtain the model mask by mapping the mesh created by reading in the model_maskfile to the + ! model mesh and then reset the model mesh mask + call dshr_set_modelmask(model_mesh, model_maskfile, compname, model_mask, model_frac, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! obtain model mask and model frac from separate model_maskfile - rcode = pio_openfile(pio_subsystem, pioid, io_type, trim(model_maskfile), pio_nowrite) - call pio_seterrorhandling(pioid, PIO_BCAST_ERROR) - rcode = pio_inq_varid(pioid, 'mask', varid) - if ( rcode /= PIO_NOERR ) then - call shr_sys_abort(' ERROR: variable mask not found in file '//trim(model_maskfile)) - end if - call pio_seterrorhandling(pioid, PIO_INTERNAL_ERROR) - call pio_initdecomp(pio_subsystem, pio_int, (/model_nxg, model_nyg/), model_gindex, pio_iodesc) - call pio_read_darray(pioid, varid, pio_iodesc, model_mask, rcode) - call pio_freedecomp(pio_subsystem, pio_iodesc) - - ! obtain model model frac from separate model_maskfile - call pio_seterrorhandling(pioid, PIO_BCAST_ERROR) - rcode = pio_inq_varid(pioid, 'frac', varid) - if ( rcode /= PIO_NOERR ) then - call shr_sys_abort(' ERROR: variable frac not found in file '//trim(model_maskfile)) + if (masterproc) then + write(logunit,F00) trim(subname)// " obtained "//trim(compname)//" mesh from "// & + trim(model_meshfile) + write(logunit,F00) trim(subname)// " obtained "//trim(compname)//" mask from "// & + trim(model_maskfile) end if - call pio_seterrorhandling(pioid, PIO_INTERNAL_ERROR) - call pio_initdecomp(pio_subsystem, pio_double, (/model_nxg, model_nyg/), model_gindex, pio_iodesc) - call pio_read_darray(pioid, varid, pio_iodesc, model_frac, rcode) - call pio_freedecomp(pio_subsystem, pio_iodesc) - - ! close file - call pio_closefile(pioid) - - ! deallocate pointers - deallocate(model_gindex) - - ! reset the model mesh mask - call ESMF_MeshSet(model_mesh, elementMask=model_mask, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return else ! model_meshfile and model_maskfile are the same @@ -407,13 +367,13 @@ subroutine dshr_mesh_init(gcomp, nullstr, logunit, compname, model_nxg, model_ny call ESMF_ArrayDestroy(elemMaskArray, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (masterproc) then + write(logunit,F00) trim(subname)// " obtained "//trim(compname)//" mesh and mask from "// & + trim(model_meshfile) + end if end if - end if - if (masterproc) then - write(logunit,F00) trim(subname)// " obtaining "//trim(compname)//" mesh from "// trim(model_meshfile) - end if end subroutine dshr_mesh_init @@ -1608,4 +1568,127 @@ real(R8) function getNextRadCDay_i8( ymd, tod, stepno, dtime, iradsw, calendar ) end function getNextRadCDay_i8 + !=============================================================================== + subroutine dshr_set_modelmask(mesh_dst, meshfile_mask, compname, mask_dst, frac_dst, rc) + + use ESMF, only : ESMF_FieldRegridStore, ESMF_FieldRegrid, ESMF_FIELDCREATE + use ESMF, only : ESMF_REGRIDMETHOD_CONSERVE, ESMF_NORMTYPE_DSTAREA, ESMF_UNMAPPEDACTION_IGNORE + use ESMF, only : ESMF_TYPEKIND_R8, ESMF_MESHLOC_ELEMENT + use ESMF, only : ESMF_RouteHandleDestroy, ESMF_FieldDestroy + + ! input/out variables + type(ESMF_Mesh) , intent(in) :: mesh_dst + character(len=*) , intent(in) :: meshfile_mask + character(len=*) , intent(in) :: compname + integer , pointer , intent(out) :: mask_dst(:) + real(r8), pointer , intent(out) :: frac_dst(:) + integer , intent(out) :: rc + + ! local variables: + type(ESMF_Mesh) :: mesh_mask + type(ESMF_Field) :: field_mask + type(ESMF_Field) :: field_dst + type(ESMF_RouteHandle) :: rhandle + integer :: srcMaskValue = 0 + integer :: dstMaskValue = -987987 ! spval for RH mask values + integer :: srcTermProcessing_Value = 0 + logical :: checkflag = .false. + real(r8) , pointer :: mask_src(:) ! on mesh created from meshfile_mask + real(r8) , pointer :: dataptr1d(:) + type(ESMF_DistGrid) :: distgrid_mask + type(ESMF_Array) :: elemMaskArray + integer :: lsize_mask, lsize_dst + integer :: n, spatialDim + real(r8) :: fminval = 0.001_r8 + real(r8) :: fmaxval = 1._r8 + real(r8) :: lfrac,ofrac + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + mesh_mask = ESMF_MeshCreate(trim(meshfile_mask), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_MeshGet(mesh_dst, spatialDim=spatialDim, numOwnedElements=lsize_dst, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(mask_dst(lsize_dst)) + allocate(frac_dst(lsize_dst)) + + ! create fields on source and destination meshes + field_mask = ESMF_FieldCreate(mesh_mask, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + field_dst = ESMF_FieldCreate(mesh_dst, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! create route handle to map source mask (assume ocean) to destination mesh (assume atm/lnd) + call ESMF_FieldRegridStore(field_mask, field_dst, routehandle=rhandle, & + srcMaskValues=(/srcMaskValue/), dstMaskValues=(/dstMaskValue/), & + regridmethod=ESMF_REGRIDMETHOD_CONSERVE, normType=ESMF_NORMTYPE_DSTAREA, & + srcTermProcessing=srcTermProcessing_Value, & + ignoreDegenerate=.true., unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! fill in values for field_mask with mask on source mesh + call ESMF_MeshGet(mesh_mask, elementdistGrid=distgrid_mask, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_DistGridGet(distgrid_mask, localDe=0, elementCount=lsize_mask, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(mask_src(lsize_mask)) + elemMaskArray = ESMF_ArrayCreate(distgrid_mask, mask_src, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! The following call fills in the values of mask_src + call ESMF_MeshGet(mesh_mask, elemMaskArray=elemMaskArray, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! The following call fills in the values of field_mask + call ESMF_FieldGet(field_mask, farrayptr=dataptr1d, rc=rc) + dataptr1d(:) = mask_src(:) + + ! map source mask to destination mesh - to obtain destination mask and frac + call ESMF_FieldRegrid(field_mask, field_dst, routehandle=rhandle, & + termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=checkflag, zeroregion=ESMF_REGION_TOTAL, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! now determine mask_dst and frac_dst + call ESMF_MeshGet(mesh_dst, spatialDim=spatialDim, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(field_dst, farrayptr=dataptr1d, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + do n = 1,lsize_dst + lfrac = 1._r8 - dataptr1d(n) + if (lfrac > fmaxval) lfrac = 1._r8 + if (lfrac < fminval) lfrac = 0._r8 + ofrac = 1._r8 - lfrac + if (compname == 'LND') then + frac_dst(n) = lfrac + if (lfrac /= 0._r8) then + mask_dst(n) = 1 + else + mask_dst(n) = 0 + end if + else if (compname == 'OCN' .or. compname == 'ICE') then + frac_dst(n) = ofrac + if (ofrac == 0._r8) then + mask_dst(n) = 0 + else + mask_dst(n) = 1 + end if + end if + enddo + + ! reset the model mesh mask + call ESMF_MeshSet(mesh_dst, elementMask=mask_dst, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! deallocate memory + call ESMF_RouteHandleDestroy(rhandle, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldDestroy(field_mask, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldDestroy(field_dst, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + deallocate(mask_src) + + end subroutine dshr_set_modelmask + end module dshr_mod diff --git a/dwav/CMakeLists.txt b/dwav/CMakeLists.txt index c848741c6..97fccbd52 100644 --- a/dwav/CMakeLists.txt +++ b/dwav/CMakeLists.txt @@ -1,5 +1,6 @@ project(dwav Fortran) set(SRCFILES wav_comp_nuopc.F90) + foreach(FILE ${SRCFILES}) if(EXISTS "${CASEROOT}/SourceMods/src.dwav/${FILE}") list(REMOVE_ITEM SRCFILES ${FILE}) @@ -8,12 +9,14 @@ foreach(FILE ${SRCFILES}) endif() endforeach() -add_library(dwav ${SRCFILES}) +message("DWAV srcfiles are ${SRCFILES}") +add_library(dwav ${SRCFILES}) -target_include_directories (dwav PUBLIC ${ESMF_F90COMPILEPATHS}) -target_include_directories (dwav PUBLIC "${CMAKE_BINARY_DIR}/dshr") -target_include_directories (dwav PUBLIC "${CMAKE_SOURCE_DIR}") -target_include_directories (dwav PUBLIC "${CMAKE_BINARY_DIR}/share") -target_include_directories (dwav PUBLIC "${CMAKE_BINARY_DIR}/streams") -target_include_directories (dwav PUBLIC "${PIO_Fortran_INCLUDE_DIR}") +add_dependencies(dwav dshr streams) +target_include_directories (dwav PRIVATE ${ESMF_F90COMPILEPATHS}) +target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (dwav PRIVATE "${CMAKE_SOURCE_DIR}") +target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") +target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (dwav PRIVATE "${PIO_Fortran_INCLUDE_DIR}") diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index 0fe275baa..a6aa72243 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -4,7 +4,13 @@ module wav_comp_nuopc ! This is the NUOPC cap for DWAV !---------------------------------------------------------------------------- - use ESMF + use ESMF , only : ESMF_SUCCESS, ESMF_TraceRegionExit, ESMF_TraceRegionEnter + use ESMF , only : ESMF_State, ESMF_Clock, ESMF_Alarm, ESMF_LogWrite, ESMF_Time + use ESMF , only : ESMF_ClockGetAlarm, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_Mesh, ESMF_GridComp, ESMF_TimeInterval, ESMF_GridCompSetEntryPoint + use ESMF , only : ESMF_METHOD_INITIALIZE, ESMF_MethodAdd, ESMF_MethodRemove + use ESMF , only : ESMF_ClockGet, ESMF_TimeGet, operator(+), ESMF_AlarmRingerOff + use ESMF , only : ESMF_AlarmIsRinging use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise use NUOPC_Model , only : model_routine_SS => SetServices diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 06bb2c7d3..cc71a4217 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -20,8 +20,10 @@ add_library(cdeps_share ${GenF90_SRCS} shr_precip_mod.F90 shr_string_mod.F90) -target_include_directories (cdeps_share PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${ESMF_F90COMPILEPATHS} ${PIO_Fortran_INCLUDE_DIRS}) +target_include_directories (cdeps_share PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${ESMF_F90COMPILEPATHS} ${PIO_Fortran_INCLUDE_DIRS}) +install(TARGETS cdeps_share + LIBRARY DESTINATION lib) #===== genf90 ===== if (DEFINED GENF90_PATH) diff --git a/streams/CMakeLists.txt b/streams/CMakeLists.txt index 013ee7a40..ee9a924e3 100644 --- a/streams/CMakeLists.txt +++ b/streams/CMakeLists.txt @@ -2,7 +2,9 @@ set(SRCFILES dshr_methods_mod.F90 dshr_strdata_mod.F90 dshr_stream_mod.F90 dshr_tinterp_mod.F90) + set(MODFILES ${SRCFILES}) + foreach(FILE ${SRCFILES}) list(TRANSFORM MODFILES REPLACE ".F90" ".mod") if(EXISTS "${CASEROOT}/SourceMods/src.cdeps/${FILE}") @@ -11,16 +13,21 @@ foreach(FILE ${SRCFILES}) message("Using ${FILE} from ${CASEROOT}/SourceMods/src.cdeps") endif() endforeach() + message("Stream srcfiles are ${SRCFILES}") + add_library(streams ${SRCFILES}) + add_dependencies(streams FoX_dom) if(BLD_STANDALONE) add_dependencies(streams cdeps_share) endif() -target_include_directories (streams PUBLIC ${CMAKE_BINARY_DIR}/fox/include) -target_include_directories (streams PUBLIC ${ESMF_F90COMPILEPATHS}) -target_include_directories (streams PUBLIC ${PIO_Fortran_INCLUDE_DIR}) -target_include_directories (streams PUBLIC ${CMAKE_BINARY_DIR}/share) + +target_include_directories (streams PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/fox/include) +target_include_directories (streams PRIVATE ${ESMF_F90COMPILEPATHS}) +target_include_directories (streams PRIVATE ${PIO_Fortran_INCLUDE_DIR}) +target_include_directories (streams PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) + install(TARGETS streams LIBRARY DESTINATION lib) foreach(MOD ${MODFILES}) diff --git a/streams/dshr_methods_mod.F90 b/streams/dshr_methods_mod.F90 index b16d0ad4f..3f194cbd3 100644 --- a/streams/dshr_methods_mod.F90 +++ b/streams/dshr_methods_mod.F90 @@ -2,7 +2,16 @@ module dshr_methods_mod ! Share methods for data model functionality - use ESMF + use ESMF , only : ESMF_State, ESMF_Field, ESMF_StateGet, ESMF_FieldBundle + use ESMF , only : ESMF_LogWrite, ESMF_SUCCESS, ESMF_FAILURE + use ESMF , only : ESMF_StateRemove, ESMF_StateGet, ESMF_RouteHandle + use ESMF , only : ESMF_Region_Flag, ESMF_FieldStatus_Flag, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_MAXSTR, ESMF_LOGMSG_ERROR, ESMF_LOGERR_PASSTHRU + use ESMF , only : ESMF_FieldBundleGet, ESMF_FieldBundleAdd, ESMF_FieldGet + use ESMF , only : ESMF_REGION_TOTAL, ESMF_END_ABORT, ESMF_ITEMORDER_ADDORDER + use ESMF , only : ESMF_LogFoundError, ESMF_FieldRegrid, ESMF_Finalize, ESMF_FIELDSTATUS_COMPLETE + use ESMF , only : ESMF_TERMORDER_SRCSEQ, operator(/=) + use ESMF , only : ESMF_TraceRegionEnter, ESMF_TraceRegionExit use shr_kind_mod , only : r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl implicit none @@ -156,11 +165,12 @@ subroutine dshr_fldbun_GetFldPtr(FB, fldname, fldptr1, fldptr2, rank, field, rc) real(R8), pointer , intent(inout), optional :: fldptr2(:,:) integer , intent(out), optional :: rank type(ESMF_Field) , intent(out), optional :: field - integer , intent(out) :: rc + integer , intent(out) :: rc ! local variables - type(ESMF_Field) :: lfield - integer :: lrank + integer :: lrank + type(ESMF_Field) :: lfield + integer :: ungriddedUBound(1) character(len=*), parameter :: subname='(dshr_fldbun_GetFldPtr)' ! ---------------------------------------------- @@ -171,16 +181,35 @@ subroutine dshr_fldbun_GetFldPtr(FB, fldname, fldptr1, fldptr2, rank, field, rc) rc = ESMF_FAILURE return endif - call ESMF_FieldBundleGet(FB, fieldName=trim(fldname), field=lfield, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_field_getfldptr(lfield, fldptr1=fldptr1, fldptr2=fldptr2, rank=lrank, rc=rc) + call ESMF_FieldGet(lfield, ungriddedUBound=ungriddedUBound, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - + if (ungriddedUBound(1) > 0) then + if (.not.present(fldptr2)) then + call ESMF_LogWrite(trim(subname)//": ERROR missing rank=2 array ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + call ESMF_FieldGet(lfield, farrayptr=fldptr2, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + lrank = 2 + else + if (.not.present(fldptr1)) then + call ESMF_LogWrite(trim(subname)//": ERROR missing rank=1 array ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + call ESMF_FieldGet(lfield, farrayptr=fldptr1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + lrank = 1 + end if if (present(rank)) rank = lrank if (present(field)) field = lfield - end subroutine dshr_fldbun_getfldptr + end subroutine dshr_fldbun_GetFldPtr !=============================================================================== subroutine dshr_fldbun_regrid(FBsrc, FBdst, RH, zeroregion, rc) @@ -509,79 +538,54 @@ subroutine dshr_field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) ! local variables type(ESMF_FieldStatus_Flag) :: status - type(ESMF_Mesh) :: lmesh - integer :: lrank, nnodes, nelements + integer :: ungriddedUBound(1) + integer :: lrank logical :: labort character(len=*), parameter :: subname='(field_getfldptr)' ! ---------------------------------------------- - rc = ESMF_SUCCESS labort = .true. if (present(abort)) then labort = abort endif - lrank = -99 call ESMF_FieldGet(field, status=status, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - if (status /= ESMF_FIELDSTATUS_COMPLETE) then - - lrank = 0 if (labort) then - call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_INFO, rc=rc) + call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_ERROR, rc=rc) rc = ESMF_FAILURE return else call ESMF_LogWrite(trim(subname)//": WARNING data not allocated ", ESMF_LOGMSG_INFO, rc=rc) endif - else - - call ESMF_FieldGet(field, rank=lrank, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(field, mesh=lmesh, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_MeshGet(lmesh, numOwnedNodes=nnodes, numOwnedElements=nelements, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (nnodes == 0 .and. nelements == 0) then - lrank = 0 - end if - - if (lrank == 0) then - call ESMF_LogWrite(trim(subname)//": no local nodes or elements ", & - ESMF_LOGMSG_INFO) - elseif (lrank == 1) then - if (.not.present(fldptr1)) then - call ESMF_LogWrite(trim(subname)//": ERROR missing rank=1 array ", & - ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) - rc = ESMF_FAILURE - return - endif - call ESMF_FieldGet(field, farrayPtr=fldptr1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - elseif (lrank == 2) then - if (.not.present(fldptr2)) then - call ESMF_LogWrite(trim(subname)//": ERROR missing rank=2 array ", & - ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) - rc = ESMF_FAILURE - return - endif - call ESMF_FieldGet(field, farrayPtr=fldptr2, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - else - call ESMF_LogWrite(trim(subname)//": ERROR in rank ", & - ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) - rc = ESMF_FAILURE - return - endif - + call ESMF_FieldGet(field, ungriddedUBound=ungriddedUBound, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (ungriddedUBound(1) > 0) then + if (.not.present(fldptr2)) then + call ESMF_LogWrite(trim(subname)//": ERROR missing rank=2 array ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + call ESMF_FieldGet(field, farrayptr=fldptr2, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + lrank = 2 + else + if (.not.present(fldptr1)) then + call ESMF_LogWrite(trim(subname)//": ERROR missing rank=1 array ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + call ESMF_FieldGet(field, farrayptr=fldptr1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + lrank = 1 + end if endif ! status - - if (present(rank)) then - rank = lrank - endif + if (present(rank)) rank = lrank end subroutine dshr_field_getfldptr @@ -595,12 +599,16 @@ subroutine memcheck(string, level, mastertask) ! local variables integer :: ierr +#ifdef CESMCOUPLED integer, external :: GPTLprint_memusage +#endif !----------------------------------------------------------------------- +#ifdef CESMCOUPLED if ((mastertask .and. memdebug_level > level) .or. memdebug_level > level+1) then ierr = GPTLprint_memusage(string) endif +#endif end subroutine memcheck diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 9a6d9af80..37de93636 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -3,8 +3,21 @@ module dshr_strdata_mod ! holds data and methods to advance data models ! Obtain the model domain and the stream domain for each stream - use ESMF - + use ESMF , only : ESMF_Mesh, ESMF_RouteHandle, ESMF_Field, ESMF_FieldBundle + use ESMF , only : ESMF_Clock, ESMF_VM, ESMF_VMGet, ESMF_VMGetCurrent + use ESMF , only : ESMF_DistGrid, ESMF_SUCCESS, ESMF_MeshGet, ESMF_DistGridGet + use ESMF , only : ESMF_VMBroadCast, ESMF_MeshIsCreated, ESMF_MeshCreate + use ESMF , only : ESMF_Calendar, ESMF_CALKIND_NOLEAP, ESMF_CALKIND_GREGORIAN + use ESMF , only : ESMF_CalKind_Flag, ESMF_Time, ESMF_TimeInterval + use ESMF , only : ESMF_TimeIntervalGet, ESMF_TYPEKIND_R8, ESMF_FieldCreate + use ESMF , only : ESMF_FILEFORMAT_ESMFMESH, ESMF_FieldCreate + use ESMF , only : ESMF_FieldBundleCreate, ESMF_MESHLOC_ELEMENT, ESMF_FieldBundleAdd + use ESMF , only : ESMF_POLEMETHOD_ALLAVG, ESMF_EXTRAPMETHOD_NEAREST_STOD, ESMF_REGRIDMETHOD_BILINEAR, ESMF_REGRIDMETHOD_NEAREST_STOD + use ESMF , only : ESMF_ClockGet, operator(-), operator(==), ESMF_CALKIND_NOLEAP + use ESMF , only : ESMF_FieldReGridStore, ESMF_FieldRedistStore, ESMF_UNMAPPEDACTION_IGNORE + use ESMF , only : ESMF_TERMORDER_SRCSEQ, ESMF_FieldRegrid, ESMF_FieldFill + use ESMF , only : ESMF_REGION_TOTAL, ESMF_FieldGet, ESMF_TraceRegionExit, ESMF_TraceRegionEnter + use ESMF , only : ESMF_LOGMSG_INFO, ESMF_LogWrite use shr_kind_mod , only : r8=>shr_kind_r8, r4=>shr_kind_r4, i2=>shr_kind_I2 use shr_kind_mod , only : cs=>shr_kind_cs, cl=>shr_kind_cl, cxx=>shr_kind_cxx use shr_sys_mod , only : shr_sys_abort @@ -78,7 +91,7 @@ module dshr_strdata_mod integer :: stream_ub ! index of the Upperbound (UB) in fldlist_stream type(ESMF_Field) :: field_stream ! a field on the stream data domain type(ESMF_Field) :: stream_vector ! a vector field on the stream data domain - type(ESMF_FieldBundle), allocatable :: fldbun_data(:) ! stream field bundle interpolated to model grid + type(ESMF_FieldBundle), allocatable :: fldbun_data(:) ! stream field bundle interpolated to model grid spatially type(ESMF_FieldBundle) :: fldbun_model ! stream n field bundle interpolated to model grid and time integer :: ucomp = -1 ! index of vector u in stream integer :: vcomp = -1 ! index of vector v in stream @@ -174,8 +187,8 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn integer :: localPet character(len=*), parameter :: subname='(shr_strdata_init_from_xml)' ! ---------------------------------------------- - rc = ESMF_SUCCESS + call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) ! Initialize log unit sdat%logunit = logunit @@ -291,6 +304,7 @@ subroutine shr_strdata_init_model_domain( sdat, rc) integer :: spatialDim ! number of dimension in mesh integer :: numOwnedElements ! local size of mesh real(r8), allocatable :: ownedElemCoords(:) ! mesh lat and lons + character(len=*), parameter :: subname='(shr_strdata_init_model_domain)' ! ---------------------------------------------- rc = ESMF_SUCCESS @@ -361,9 +375,7 @@ subroutine shr_strdata_init(sdat, model_clock, rc) integer :: nvars integer :: i, stream_nlev, index character(CL) :: stream_vectors - character(len=*), parameter :: subname='(shr_strdata_mod:shr_sdat_init)' - character(*) , parameter :: F00 = "('(shr_sdat_init) ',a)" - character(*) , parameter :: F01 = "('(shr_sdat) ',a,2x,i8)" + character(len=*), parameter :: subname='(shr_sdat_init)' ! ---------------------------------------------- rc = ESMF_SUCCESS @@ -387,14 +399,14 @@ subroutine shr_strdata_init(sdat, model_clock, rc) if (filename /= 'none' .and. masterproc) then inquire(file=trim(filename),exist=fileExists) if (.not. fileExists) then - write(sdat%logunit,F00) "ERROR: file does not exist: ", trim(fileName) + write(sdat%logunit,'(a)') "ERROR: file does not exist: "//trim(fileName) call shr_sys_abort(subName//"ERROR: file does not exist: "//trim(fileName)) end if endif if(filename /= 'none') then stream_mesh = ESMF_MeshCreate(trim(filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return endif - if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Determine the number of stream levels call shr_strdata_get_stream_nlev(sdat, ns, rc=rc) @@ -403,7 +415,7 @@ subroutine shr_strdata_init(sdat, model_clock, rc) ! Determine field names for stream fields with both stream file names and data model names nvars = sdat%stream(ns)%nvars - ! Allocate memory + ! Allocate memory allocate(sdat%pstrm(ns)%fldList_model(nvars)) call shr_stream_getModelFieldList(sdat%stream(ns), sdat%pstrm(ns)%fldlist_model) allocate(sdat%pstrm(ns)%fldlist_stream(nvars)) @@ -492,39 +504,42 @@ subroutine shr_strdata_init(sdat, model_clock, rc) end if endif - ! TODO: why not just use fldbun_model rather than fldbun_data - + ! Why not use fldbun_model rather than fldbun_data? index = sdat%pstrm(ns)%stream_lb call dshr_fldbun_getFieldN(sdat%pstrm(ns)%fldbun_data(index), 1, lfield_dst, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - if (trim(sdat%stream(ns)%mapalgo) == "bilinear") then - call ESMF_FieldRegridStore(sdat%pstrm(ns)%field_stream, lfield_dst, & - routehandle=sdat%pstrm(ns)%routehandle, & - regridmethod=ESMF_REGRIDMETHOD_BILINEAR, & - polemethod=ESMF_POLEMETHOD_ALLAVG, & - extrapMethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & - dstMaskValues = (/0/), & ! ignore destination points where the mask is 0 - srcMaskValues = (/0/), & ! ignore source points where the mask is 0 - srcTermProcessing=srcTermProcessing_Value, ignoreDegenerate=.true., rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - else if (trim(sdat%stream(ns)%mapalgo) == 'redist') then - call ESMF_FieldRedistStore(sdat%pstrm(ns)%field_stream, lfield_dst, & - routehandle=sdat%pstrm(ns)%routehandle, & - ignoreUnmatchedIndices = .true., rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - else if (trim(sdat%stream(ns)%mapalgo) == 'nn') then - call ESMF_FieldReGridStore(sdat%pstrm(ns)%field_stream, lfield_dst, & - routehandle=sdat%pstrm(ns)%routehandle, & - regridmethod=ESMF_REGRIDMETHOD_NEAREST_STOD, & - dstMaskValues = (/0/), & ! ignore destination points where the mask is 0 - srcMaskValues = (/0/), & ! ignore source points where the mask is 0 - srcTermProcessing=srcTermProcessing_Value, ignoreDegenerate=.true., & - unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, rc=rc) - else if (trim(sdat%stream(ns)%mapalgo) == 'none') then - ! single point stream data, no action required. + if (.not. ESMF_MeshIsCreated(stream_mesh)) then + sdat%stream(ns)%mapalgo = 'none' else - call shr_sys_abort('ERROR: map algo '//trim(sdat%stream(ns)%mapalgo)//' is not supported') + if (trim(sdat%stream(ns)%mapalgo) == "bilinear") then + call ESMF_FieldRegridStore(sdat%pstrm(ns)%field_stream, lfield_dst, & + routehandle=sdat%pstrm(ns)%routehandle, & + regridmethod=ESMF_REGRIDMETHOD_BILINEAR, & + polemethod=ESMF_POLEMETHOD_ALLAVG, & + extrapMethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & + dstMaskValues = (/0/), & ! ignore destination points where the mask is 0 + srcMaskValues = (/0/), & ! ignore source points where the mask is 0 + srcTermProcessing=srcTermProcessing_Value, ignoreDegenerate=.true., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + else if (trim(sdat%stream(ns)%mapalgo) == 'redist') then + call ESMF_FieldRedistStore(sdat%pstrm(ns)%field_stream, lfield_dst, & + routehandle=sdat%pstrm(ns)%routehandle, & + ignoreUnmatchedIndices = .true., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + else if (trim(sdat%stream(ns)%mapalgo) == 'nn') then + call ESMF_FieldReGridStore(sdat%pstrm(ns)%field_stream, lfield_dst, & + routehandle=sdat%pstrm(ns)%routehandle, & + regridmethod=ESMF_REGRIDMETHOD_NEAREST_STOD, & + dstMaskValues = (/0/), & ! ignore destination points where the mask is 0 + srcMaskValues = (/0/), & ! ignore source points where the mask is 0 + srcTermProcessing=srcTermProcessing_Value, ignoreDegenerate=.true., & + unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, rc=rc) + else if (trim(sdat%stream(ns)%mapalgo) == 'none') then + ! single point stream data, no action required. + else + call shr_sys_abort('ERROR: map algo '//trim(sdat%stream(ns)%mapalgo)//' is not supported') + end if end if end do ! end of loop over streams @@ -854,9 +869,7 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) select case(sdat%stream(ns)%readmode) case ('single') - call shr_strdata_readLBUB(sdat, ns, & - ymdmod(ns), todmod, & - newData(ns), trim(lstr)//'_readLBUB', rc=rc) + call shr_strdata_readLBUB(sdat, ns, ymdmod(ns), todmod, newData(ns), trim(lstr)//'_readLBUB', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('full_file') ! TODO: need to put in capability to read all stream data at once @@ -1201,7 +1214,7 @@ subroutine shr_strdata_readLBUB(sdat, ns, mDate, mSec, newData, istr, rc) ! if model current date is outside of model lower or upper bound - find the stream bounds if (rDateM < rDateLB .or. rDateM > rDateUB) then call ESMF_TraceRegionEnter(trim(istr)//'_fbound') - call shr_stream_findBounds(stream, mDate, mSec, & + call shr_stream_findBounds(stream, mDate, mSec, sdat%masterproc, & sdat%pstrm(ns)%ymdLB, dDateLB, sdat%pstrm(ns)%todLB, n_lb, filename_lb, & sdat%pstrm(ns)%ymdUB, dDateUB, sdat%pstrm(ns)%todUB, n_ub, filename_ub) call ESMF_TraceRegionExit(trim(istr)//'_fbound') @@ -1297,7 +1310,7 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & integer :: pio_iovartype real(r8), pointer :: nv_coords(:), nu_coords(:) real(r8), pointer :: data_u_dst(:), data_v_dst(:) - real(r8) :: lat, lon + real(r8) :: lat, lon real(r8) :: sinlat, sinlon real(r8) :: coslat, coslon real(r8) :: scale_factor, add_offset @@ -1345,6 +1358,7 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & if (ESMF_MeshIsCreated(per_stream%stream_mesh)) then if (.not. per_stream%stream_pio_iodesc_set) then + if (sdat%masterproc) write(sdat%logunit,F00) 'setting pio descriptor : ',trim(filename) call shr_strdata_set_stream_iodesc(sdat, per_stream, trim(per_stream%fldlist_stream(1)), & pioid, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -1374,7 +1388,7 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & call ESMF_TraceRegionEnter(trim(istr)//'_readpio') if (sdat%masterproc) then - write(sdat%logunit,F02) 'file ' // trim(boundstr) //': ',trim(filename), nt + write(sdat%logunit,F02) 'reading file ' // trim(boundstr) //': ',trim(filename), nt endif if(per_stream%ucomp > 0 .and. per_stream%vcomp > 0) then @@ -1679,7 +1693,7 @@ subroutine shr_strdata_readstrm(sdat, per_stream, stream, fldbun_data, & data_u_dst(i) = coslon * dataptr2d_dst(1,i) + sinlon * dataptr2d_dst(2,i) data_v_dst(i) = -sinlon * dataptr2d_dst(1,i) + coslon * dataptr2d_dst(2,i) enddo - + deallocate(dataptr) endif diff --git a/streams/dshr_stream_mod.F90 b/streams/dshr_stream_mod.F90 index 0a4da07cc..ebf1cbde7 100644 --- a/streams/dshr_stream_mod.F90 +++ b/streams/dshr_stream_mod.F90 @@ -26,7 +26,7 @@ module dshr_stream_mod use shr_cal_mod , only : shr_cal_advDate use shr_cal_mod , only : shr_cal_advdateint use dshr_methods_mod , only : chkerr - use pio , only : pio_noerr, pio_seterrorhandling, pio_inq_att, pio_openfile + use pio , only : pio_noerr, pio_seterrorhandling, pio_inq_att, pio_openfile, pio_closefile use pio , only : file_desc_t, pio_inq_varid, iosystem_desc_t, pio_file_is_open use pio , only : pio_nowrite, pio_inquire_dimension, pio_inquire_variable, pio_bcast_error use pio , only : pio_get_att, pio_get_var @@ -120,9 +120,10 @@ module dshr_stream_mod contains !=============================================================================== - subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, compname, rc) + subroutine shr_stream_init_from_xml(xmlfilename, streamdat, isroot_task, logunit, compname, rc) - use FoX_DOM + use FoX_DOM, only : extractDataContent, destroy, Node, NodeList, parseFile, getElementsByTagname + use FoX_DOM, only : getLength, item use ESMF, only : ESMF_VM, ESMF_VMGetCurrent, ESMF_VMBroadCast, ESMF_SUCCESS ! --------------------------------------------------------------------- @@ -140,7 +141,7 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, ! ! ! - ! + ! ! ! ! @@ -154,10 +155,10 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, ! input/output variables type(shr_stream_streamType) , intent(inout), pointer :: streamdat(:) - character(len=*) , intent(in) :: xmlfilename - logical , intent(in) :: mastertask integer , intent(in) :: logunit + logical , intent(in) :: isroot_task character(len=*) , intent(in) :: compname + character(len=*), optional , intent(in) :: xmlfilename integer , intent(out) :: rc ! local variables @@ -176,7 +177,7 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, nstrms = 0 - if (mastertask) then + if (isroot_task) then Sdoc => parseFile(xmlfilename, iostat=status) if (status /= 0) then @@ -185,7 +186,7 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, streamlist => getElementsByTagname(Sdoc, "stream_info") nstrms = getLength(streamlist) - ! allocate an array of shr_stream_streamtype objects on just mastertask + ! allocate an array of shr_stream_streamtype objects on just isroot_task allocate(streamdat(nstrms)) ! fill in non-default values for the streamdat attributes @@ -291,7 +292,7 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, call ESMF_VMBroadCast(vm, tmp, 1, 0, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return nstrms = tmp(1) - if (.not. mastertask) then + if (.not. isroot_task) then allocate(streamdat(nstrms)) endif @@ -311,7 +312,7 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit, streamdat(i)%yearLast = tmp(4) streamdat(i)%yearAlign = tmp(5) streamdat(i)%offset = tmp(6) - if(.not. mastertask) then + if(.not. isroot_task) then allocate(streamdat(i)%file(streamdat(i)%nfiles)) allocate(streamdat(i)%varlist(streamdat(i)%nvars)) endif @@ -457,7 +458,7 @@ subroutine shr_stream_init_from_inline(streamdat, & end subroutine shr_stream_init_from_inline !=============================================================================== - subroutine shr_stream_findBounds(strm, mDateIn, secIn, & + subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & mDateLB, dDateLB, secLB, n_lb, fileLB, mDateUB, dDateUB, secUB, n_ub, fileUB) !------------------------------------------------------------------------------- @@ -471,19 +472,20 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, & !------------------------------------------------------------------------------- ! input/output parameters: - type(shr_stream_streamType) ,intent(inout):: strm ! data stream to query - integer ,intent(in) :: mDateIn ! model date (yyyymmdd) - integer ,intent(in) :: secIn ! elapsed sec on model date - integer ,intent(out) :: mDateLB ! model date of LB - integer ,intent(out) :: dDateLB ! data date of LB - integer ,intent(out) :: secLB ! elap sec of LB - integer ,intent(out) :: n_lb ! t-coord index of LB - character(*) ,intent(out) :: fileLB ! file containing LB - integer ,intent(out) :: mDateUB ! model date of UB - integer ,intent(out) :: dDateUB ! data date of UB - integer ,intent(out) :: secUB ! elap sec of UB - integer ,intent(out) :: n_ub ! t-coord index of UB - character(*) ,intent(out) :: fileUB ! file containing UB + type(shr_stream_streamType) ,intent(inout):: strm ! data stream to query + integer ,intent(in) :: mDateIn ! model date (yyyymmdd) + integer ,intent(in) :: secIn ! elapsed sec on model date + logical ,intent(in) :: isroot_task ! is mpi task root communicator task + integer ,intent(out) :: mDateLB ! model date of LB + integer ,intent(out) :: dDateLB ! data date of LB + integer ,intent(out) :: secLB ! elap sec of LB + integer ,intent(out) :: n_lb ! t-coord index of LB + character(*) ,intent(out) :: fileLB ! file containing LB + integer ,intent(out) :: mDateUB ! model date of UB + integer ,intent(out) :: dDateUB ! data date of UB + integer ,intent(out) :: secUB ! elap sec of UB + integer ,intent(out) :: n_ub ! t-coord index of UB + character(*) ,intent(out) :: fileUB ! file containing UB ! local variables integer :: dDateIn ! model date mapped onto a data date @@ -572,7 +574,7 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, & if (.not. strm%found_lvd) then A: do k=1,strm%nFiles if (.not. strm%file(k)%haveData) then - call shr_stream_readtCoord(strm, k, rCode) + call shr_stream_readtCoord(strm, k, isroot_task, rCode) if ( rCode /= 0 )then call shr_sys_abort(trim(subName)//" ERROR: readtCoord1") end if @@ -661,7 +663,7 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, & B: do k=strm%nFiles,1,-1 !--- read data for file number k --- if (.not. strm%file(k)%haveData) then - call shr_stream_readtCoord(strm, k, rCode) + call shr_stream_readtCoord(strm, k, isroot_task, rCode) if ( rCode /= 0 )then call shr_sys_abort(trim(subName)//" ERROR: readtCoord2") end if @@ -771,7 +773,7 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, & C: do k=strm%k_lvd,strm%nFiles !--- read data for file number k --- if (.not. strm%file(k)%haveData) then - call shr_stream_readtCoord(strm, k, rCode) + call shr_stream_readtCoord(strm, k, isroot_task, rCode) if ( rCode /= 0 )then call shr_sys_abort(trim(subName)//" ERROR: readtCoord3") end if @@ -905,14 +907,15 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, & end subroutine shr_stream_findBounds !=============================================================================== - subroutine shr_stream_readTCoord(strm, k, rc) + subroutine shr_stream_readTCoord(strm, k, isroot_task, rc) ! Read in time coordinates with possible offset (require that time coordinate is 'time') ! input/output parameters: - type(shr_stream_streamType) ,intent(inout) :: strm ! data stream to query - integer ,intent(in) :: k ! stream file index - integer,optional,intent(out) :: rc ! return code + type(shr_stream_streamType) ,intent(inout) :: strm ! data stream to query + integer ,intent(in) :: k ! stream file index + logical ,intent(in) :: isroot_task + integer,optional ,intent(out) :: rc ! return code ! local variables character(CL) :: fileName ! filename to read @@ -921,7 +924,6 @@ subroutine shr_stream_readTCoord(strm, k, rc) integer :: din,dout integer :: sin,sout,offin integer :: lrc - integer :: vid,ndims,rcode integer,allocatable :: dids(:) character(CS) :: units,calendar @@ -932,15 +934,20 @@ subroutine shr_stream_readTCoord(strm, k, rc) integer :: old_handle ! previous setting of pio error handling real(R8) :: nsec ! elapsed secs on calendar date real(R8),allocatable :: tvar(:) - character(*),parameter :: subname = '(shr_stream_readTCoord) ' - character(*),parameter :: F01 = "('(shr_stream_readTCoord) ',a,2i7)" + character(*),parameter :: subname = ' (shr_stream_readTCoord) ' !------------------------------------------------------------------------------- lrc = 0 - if(.not. pio_file_is_open(strm%file(k)%fileid)) then - fileName = trim(strm%file(k)%name) - rcode = pio_openfile(strm%pio_subsystem, strm%file(k)%fileid, strm%pio_iotype, & - filename, pio_nowrite) + + ! set filename to read + fileName = trim(strm%file(k)%name) + + ! open file if needed + if (.not. pio_file_is_open(strm%file(k)%fileid)) then + if (isroot_task) then + write(strm%logunit, '(a)') trim(subname)//' opening stream filename = '//trim(filename) + end if + rcode = pio_openfile(strm%pio_subsystem, strm%file(k)%fileid, strm%pio_iotype, filename, pio_nowrite) endif rCode = pio_inq_varid(strm%file(k)%fileid, 'time', vid) @@ -953,7 +960,7 @@ subroutine shr_stream_readTCoord(strm, k, rc) deallocate(dids) ! allocate memory for date and secs - if(.not. allocated(strm%file(k)%date)) then + if (.not. allocated(strm%file(k)%date)) then allocate(strm%file(k)%date(nt), strm%file(k)%secs(nt)) else if(size(strm%file(k)%date) .ne. nt) then deallocate(strm%file(k)%date, strm%file(k)%secs) @@ -997,10 +1004,17 @@ subroutine shr_stream_readTCoord(strm, k, rc) enddo deallocate(tvar) + ! close file + if (isroot_task) then + write(strm%logunit, '(a)') trim(subname)//' closing stream filename = '//trim(filename) + end if + call pio_closefile(strm%file(k)%fileid) + ! if offset is not zero, adjust strm%file(k)%date(n) and strm%file(k)%secs(n) if (strm%offset /= 0) then if (size(strm%file(k)%date) /= size(strm%file(k)%secs)) then - write(strm%logunit,F01) "Incompatable date and secs sizes",size(strm%file(k)%date),size(strm%file(k)%secs) + write(strm%logunit,'(a,2i7)') trim(subname)//" Incompatable date and secs sizes",& + size(strm%file(k)%date), size(strm%file(k)%secs) call shr_sys_abort() endif num = size(strm%file(k)%date) @@ -1186,24 +1200,27 @@ subroutine shr_stream_getCalendar(strm, k, calendar) ! Returns calendar name ! input/output parameters: - type(shr_stream_streamType) ,intent(inout) :: strm ! data stream - integer ,intent(in) :: k ! file to query - character(*) ,intent(out) :: calendar ! calendar name + type(shr_stream_streamType) ,intent(inout) :: strm ! data stream + integer ,intent(in) :: k ! file to query + character(*) ,intent(out) :: calendar ! calendar name ! local integer :: vid, n character(CL) :: fileName,lcal integer :: old_handle integer :: rCode - character(*),parameter :: subName = '(shr_stream_getCalendar) ' + character(*),parameter :: subName = ' (shr_stream_getCalendar) ' !------------------------------------------------------------------------------- lcal = ' ' calendar = ' ' if (k > strm%nfiles) call shr_sys_abort(subname//' ERROR: k gt nfiles') - if(.not. pio_file_is_open(strm%file(k)%fileid)) then - fileName = strm%file(k)%name + fileName = strm%file(k)%name + + if (.not. pio_file_is_open(strm%file(k)%fileid)) then + ! TODO: add isroot_task + !write(strm%logunit, '(a)') trim(subname)//' opening stream filename = '//trim(filename) rcode = pio_openfile(strm%pio_subsystem, strm%file(k)%fileid, strm%pio_iotype, trim(filename)) endif @@ -1221,6 +1238,10 @@ subroutine shr_stream_getCalendar(strm, k, calendar) if (ichar(lcal(n:n)) == 0 ) lcal(n:n) = ' ' call shr_string_leftalign_and_convert_tabs(lcal) calendar = trim(shr_cal_calendarName(trim(lcal))) + + ! TODO: add isroot_task + !write(strm%logunit, '(a)') trim(subname)//' closing stream filename = '//trim(filename) + call pio_closefile(strm%file(k)%fileid) end subroutine shr_stream_getCalendar @@ -1379,20 +1400,26 @@ subroutine shr_stream_getNFiles(strm,nfiles) end subroutine shr_stream_getNFiles + !=============================================================================== subroutine shr_stream_restIO(pioid, streams, mode) + use pio, only : pio_def_dim, pio_def_var, pio_put_var, pio_get_var, file_desc_t, var_desc_t use pio, only : pio_int, pio_char - type(file_desc_t), intent(inout) :: pioid - type(shr_stream_streamType), intent(inout) :: streams(:) - character(len=*), intent(in) :: mode ! read, write, define - - type(var_desc_t) :: varid, tvarid, dvarid, ntvarid, hdvarid - integer :: rcode - integer :: dimid_stream, dimid_files,dimid_nt, dimid_str - integer :: n, k, maxnfiles=0 - integer :: maxnt = 0 + + ! input/out variables + type(file_desc_t) , intent(inout) :: pioid + type(shr_stream_streamType) , intent(inout) :: streams(:) + character(len=*) , intent(in) :: mode ! read, write, define + + ! local variables + type(var_desc_t) :: varid, tvarid, dvarid, ntvarid, hdvarid + integer :: rcode + integer :: dimid_stream, dimid_files,dimid_nt, dimid_str + integer :: n, k, maxnfiles=0 + integer :: maxnt = 0 integer, allocatable :: tmp(:) - character(len=CL) :: fname + character(len=CL) :: fname + !------------------------------------------------------------------------------- if (mode .eq. 'define') then rcode = pio_def_dim(pioid, 'strlen', CL, dimid_str) diff --git a/streams/dshr_tinterp_mod.F90 b/streams/dshr_tinterp_mod.F90 index 8379cd824..10fa7b847 100644 --- a/streams/dshr_tinterp_mod.F90 +++ b/streams/dshr_tinterp_mod.F90 @@ -4,10 +4,11 @@ module dshr_tInterp_mod ! data model shared time interpolation factor routines !--------------------------------------------------------------- - use ESMF + use ESMF , only : ESMF_Time, ESMF_TimeInterval, ESMF_TimeIntervalGet + use ESMF , only : ESMF_SUCCESS, operator(<), operator(-), operator(>), operator(==) use shr_kind_mod , only : i8=>shr_kind_i8, r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl, shr_kind_in use shr_sys_mod , only : shr_sys_abort - use shr_cal_mod , only : shr_cal_timeSet, shr_cal_advDateInt, shr_cal_date2julian + use shr_cal_mod , only : shr_cal_timeSet, shr_cal_advDateInt, shr_cal_date2julian use shr_orb_mod , only : shr_orb_cosz, shr_orb_decl, SHR_ORB_UNDEF_REAL use shr_const_mod , only : SHR_CONST_PI use dshr_methods_mod , only : chkerr @@ -179,10 +180,10 @@ subroutine shr_tInterp_getAvgCosz(tavCosz, lon, lat, & real(r8) ,intent(in) :: obliqr ! orb param integer ,intent(in) :: modeldt ! model time step in secs character(*) ,intent(in) :: calendar ! calendar type - integer ,intent(out) :: rc ! error status + integer ,intent(out) :: rc ! error status ! local variables - real(R8), allocatable :: cosz(:) ! local cos of the zenith angle + real(R8), allocatable :: cosz(:) ! local cos of the zenith angle integer :: lsize ! size of local data type(ESMF_Time) :: reday1, reday2 ! LB, UB time type(ESMF_TimeInterval) :: timeint ! time interval @@ -295,15 +296,15 @@ subroutine shr_tInterp_getCosz(cosz, lon, lat, ymd, tod, eccen, mvelpp, lambm0, lsize = size(lon) if (lsize < 1 .or. size(lat) /= lsize .or. size(cosz) /= lsize) then - write(6,*)'ERROR: lsize,size(lat),size(cosz) = ',lsize,size(lat),size(cosz) + write(6,*)'ERROR: lsize,size(lat),size(cosz) = ',lsize,size(lat),size(cosz) call shr_sys_abort(subname//' ERROR: lon lat cosz sizes disagree') endif call shr_cal_date2julian(ymd, tod, calday, calendar) call shr_orb_decl( calday, eccen, mvelpp, lambm0, obliqr, declin, eccf ) do n = 1,lsize - lonr = lon(n) * deg2rad - latr = lat(n) * deg2rad + lonr = lon(n) * deg2rad + latr = lat(n) * deg2rad cosz(n) = max(solZenMin, shr_orb_cosz( calday, latr, lonr, declin)) end do From 7ca7a3de1a90824ee8a9422521bd8a3c8856c976 Mon Sep 17 00:00:00 2001 From: BinLi-NOAA Date: Tue, 16 Feb 2021 11:19:31 -0500 Subject: [PATCH 04/10] Update CDEPS to latest ESCOMP/CDEPS master and add variables for optional flux calculation (#10) --- CMakeLists.txt | 2 +- cime_config/testdefs/testlist_cdeps.xml | 14 +- datm/atm_comp_nuopc.F90 | 5 - datm/cime_config/buildnml | 6 +- datm/cime_config/config_component.xml | 75 ++++------ datm/cime_config/namelist_definition_datm.xml | 12 +- datm/cime_config/stream_definition_datm.xml | 132 +++++++++--------- datm/datm_datamode_cfsr_mod.F90 | 70 +++++++++- dice/cime_config/buildnml | 13 +- dice/cime_config/namelist_definition_dice.xml | 13 +- dlnd/cime_config/buildnml | 5 +- doc/source/streams.rst | 14 +- docn/cime_config/buildnml | 1 - docn/cime_config/namelist_definition_docn.xml | 8 +- drof/cime_config/buildnml | 3 +- dwav/cime_config/buildnml | 3 +- 16 files changed, 204 insertions(+), 172 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e764ab3c..1996e8525 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,4 +99,4 @@ foreach(DEPS streams dshr cdeps_share FoX_dom FoX_wxml FoX_sax FoX_common FoX_ut COMPONENT Library) install(EXPORT ${DEPS} DESTINATION lib/cmake) -endforeach(COMP) +endforeach(DEPS) diff --git a/cime_config/testdefs/testlist_cdeps.xml b/cime_config/testdefs/testlist_cdeps.xml index e49889d71..72f019c6c 100644 --- a/cime_config/testdefs/testlist_cdeps.xml +++ b/cime_config/testdefs/testlist_cdeps.xml @@ -1,7 +1,7 @@ - + @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ - + @@ -25,7 +25,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -49,7 +49,7 @@ - + diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index a446e10e6..6c69e9f25 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -64,11 +64,6 @@ module atm_comp_nuopc use datm_datamode_era5_mod , only : datm_datamode_era5_advance use datm_datamode_era5_mod , only : datm_datamode_era5_restart_write use datm_datamode_era5_mod , only : datm_datamode_era5_restart_read - use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_advertise - use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_init_pointers - use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_advance - use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_restart_write - use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_restart_read use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_advertise use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_init_pointers diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index ebfde5be8..265274521 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -74,8 +74,10 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['datm_co2_tseries'] = datm_co2_tseries config['datm_presaero'] = datm_presaero config['cime_model'] = get_model() - config['scol_mode'] = 'true' if case.get_value('PTS_MODE') else 'false' - config['create_mesh'] = 'true' if case.get_value("ATM_DOMAIN_MESH") == 'create_mesh' else 'false' + if case.get_value('PTS_MODE'): + config['mode'] = 'single_column' + else: + config['mode'] = case.get_value("ATM_DOMAIN_MESH") nmlgen.init_defaults(infile, config) diff --git a/datm/cime_config/config_component.xml b/datm/cime_config/config_component.xml index 59f5aef4b..d5639c3fb 100644 --- a/datm/cime_config/config_component.xml +++ b/datm/cime_config/config_component.xml @@ -159,46 +159,7 @@ case name used to determine stream filenames when DATM_MODE is CPLHIST - - integer - - -999 - run_component_datm - env_run.xml - - Simulation year corresponding to DATM_CPLHIST_YR_START (only used - when DATM_MODE is CPLHIST). A common usage is to set this to - RUN_STARTDATE. With this setting, the forcing in the first year of - the run will be the forcing of year DATM_CPLHIST_YR_START. Another - use case is to align the calendar of transient forcing with the - model calendar. For example, setting - DATM_CPLHIST_YR_ALIGN=DATM_CPLHIST_YR_START will lead to the - forcing calendar being the same as the model calendar. The forcing - for a given model year would be the forcing of the same year. This - would be appropriate in transient runs where the model calendar is - setup to span the same year range as the forcing data. - - - - - integer - - -999 - run_component_datm - env_run.xml - starting year to loop data over (only used when DATM_MODE is CPLHIST) - - - - integer - - -999 - run_component_datm - env_run.xml - ending year to loop data over (only used when DATM_MODE is CPLHIST) - - - + integer 1 @@ -209,26 +170,38 @@ 1895 1901 1901 - $DATM_CLMNCEP_YR_START + $DATM_YR_START 1895 1901 1901 - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_START + $DATM_YR_START + $DATM_YR_START + $DATM_YR_START 1 1 - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_START + $DATM_YR_START + $DATM_YR_START + $DATM_YR_START + $DATM_YR_START run_component_datm env_run.xml - year align + + Simulation year corresponding to DATM_YR_START. A common usage + is to set this to RUN_STARTDATE. With this setting, the forcing + in the first year of the run will be the forcing of year + DATM_YR_START. Another use case is to align the calendar + of transient forcing with the model calendar. For example, + setting DATM_YR_ALIGN=DATM_YR_START will lead to + the forcing calendar being the same as the model calendar. The + forcing for a given model year would be the forcing of the same + year. This would be appropriate in transient runs where the + model calendar is setup to span the same year range as the + forcing data. + - + integer 2004 @@ -270,7 +243,7 @@ starting year to loop data over - + integer 2004 diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index a8c420889..eaaf9290d 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -133,8 +133,8 @@ $ATM_DOMAIN_MESH - null - null + null + null @@ -148,8 +148,8 @@ $ATM_DOMAIN_MESH - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE + $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE + $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE @@ -163,8 +163,8 @@ null - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE + $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE + $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index d7a957bc3..24af2bacd 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -214,9 +214,9 @@ nn null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 coszen @@ -246,9 +246,9 @@ nn null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 nearest @@ -282,9 +282,9 @@ nn null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 linear @@ -317,9 +317,9 @@ bilinear null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 coszen @@ -348,9 +348,9 @@ bilinear null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 nearest @@ -383,9 +383,9 @@ nn null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 linear @@ -419,9 +419,9 @@ nn null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 coszen @@ -451,9 +451,9 @@ nn null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 nearest @@ -486,9 +486,9 @@ nn null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 linear @@ -522,7 +522,7 @@ nn null - $DATM_CLMNCEP_YR_ALIGN + $DATM_YR_ALIGN 2000 2004 0 @@ -554,7 +554,7 @@ nn null - $DATM_CLMNCEP_YR_ALIGN + $DATM_YR_ALIGN 2000 2004 0 @@ -589,7 +589,7 @@ nn null - $DATM_CLMNCEP_YR_ALIGN + $DATM_YR_ALIGN 2000 2004 0 @@ -624,9 +624,9 @@ redist null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 coszen @@ -655,9 +655,9 @@ redist null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 nearest @@ -690,9 +690,9 @@ redist null - $DATM_CLMNCEP_YR_ALIGN - $DATM_CLMNCEP_YR_START - $DATM_CLMNCEP_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 linear @@ -734,7 +734,7 @@ none null - $DATM_CLMNCEP_YR_ALIGN + $DATM_YR_ALIGN 1993 1993 0 @@ -774,7 +774,7 @@ none null - $DATM_CLMNCEP_YR_ALIGN + $DATM_YR_ALIGN 1992 1992 0 @@ -829,7 +829,7 @@ none null - $DATM_CLMNCEP_YR_ALIGN + $DATM_YR_ALIGN 0001 0002 0 @@ -3427,7 +3427,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc a2x3h_Sa_topo Sa_topo @@ -3438,9 +3438,9 @@ nn null - $DATM_CPLHIST_YR_ALIGN - $DATM_CPLHIST_YR_START - $DATM_CPLHIST_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 nearest @@ -3458,7 +3458,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1d.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1d.%ym.nc a2x1d_Faxa_bcphiwet Faxa_bcphiwet @@ -3482,9 +3482,9 @@ nn null - $DATM_CPLHIST_YR_ALIGN - $DATM_CPLHIST_YR_START - $DATM_CPLHIST_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 0 nearest @@ -3503,7 +3503,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1hi.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1hi.%ym.nc a2x1hi_Faxa_swndr Faxa_swndr @@ -3517,9 +3517,9 @@ nn null - $DATM_CPLHIST_YR_ALIGN - $DATM_CPLHIST_YR_START - $DATM_CPLHIST_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 2700 nearest @@ -3538,7 +3538,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc a2x3h_Faxa_rainc Faxa_rainc @@ -3553,9 +3553,9 @@ nn null - $DATM_CPLHIST_YR_ALIGN - $DATM_CPLHIST_YR_START - $DATM_CPLHIST_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 900 nearest @@ -3574,7 +3574,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc a2x3h_Sa_z Sa_z @@ -3593,9 +3593,9 @@ nn null - $DATM_CPLHIST_YR_ALIGN - $DATM_CPLHIST_YR_START - $DATM_CPLHIST_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 900 linear @@ -3614,7 +3614,7 @@ $ATM_DOMAIN_MESH - $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1h.%ym.nc + $DATM_CPLHIST_DIR/$DATM_CPLHIST_CASE.cpl.ha2x1h.%ym.nc a2x1h_Sa_u Sa_u @@ -3626,9 +3626,9 @@ nn null - $DATM_CPLHIST_YR_ALIGN - $DATM_CPLHIST_YR_START - $DATM_CPLHIST_YR_END + $DATM_YR_ALIGN + $DATM_YR_START + $DATM_YR_END 900 linear diff --git a/datm/datm_datamode_cfsr_mod.F90 b/datm/datm_datamode_cfsr_mod.F90 index 2b0efb849..d76235325 100644 --- a/datm/datm_datamode_cfsr_mod.F90 +++ b/datm/datm_datamode_cfsr_mod.F90 @@ -21,6 +21,7 @@ module datm_datamode_cfsr_mod public :: datm_datamode_cfsr_advance public :: datm_datamode_cfsr_restart_write public :: datm_datamode_cfsr_restart_read +! private :: datm_eSat ! determine saturation vapor pressure ! export state data real(r8), pointer :: Sa_z(:) => null() @@ -29,9 +30,14 @@ module datm_datamode_cfsr_mod real(r8), pointer :: Sa_tbot(:) => null() real(r8), pointer :: Sa_shum(:) => null() real(r8), pointer :: Sa_pbot(:) => null() + real(r8), pointer :: Sa_u10m(:) => null() + real(r8), pointer :: Sa_v10m(:) => null() + real(r8), pointer :: Sa_t2m(:) => null() + real(r8), pointer :: Sa_q2m(:) => null() + real(r8), pointer :: Sa_pslv(:) => null() real(r8), pointer :: Faxa_lwdn(:) => null() real(r8), pointer :: Faxa_rain(:) => null() - real(r8), pointer :: Faxa_snow(:) => null() + real(r8), pointer :: Faxa_snow(:) => null() real(r8), pointer :: Faxa_swndr(:) => null() real(r8), pointer :: Faxa_swndf(:) => null() real(r8), pointer :: Faxa_swvdr(:) => null() @@ -78,6 +84,11 @@ subroutine datm_datamode_cfsr_advertise(exportState, fldsexport, & call dshr_fldList_add(fldsExport, 'Sa_tbot' ) call dshr_fldList_add(fldsExport, 'Sa_pbot' ) call dshr_fldList_add(fldsExport, 'Sa_shum' ) + call dshr_fldList_add(fldsExport, 'Sa_u10m' ) + call dshr_fldList_add(fldsExport, 'Sa_v10m' ) + call dshr_fldList_add(fldsExport, 'Sa_t2m' ) + call dshr_fldList_add(fldsExport, 'Sa_q2m' ) + call dshr_fldList_add(fldsExport, 'Sa_pslv' ) call dshr_fldList_add(fldsExport, 'Faxa_rain' ) call dshr_fldList_add(fldsExport, 'Faxa_snow' ) call dshr_fldList_add(fldsExport, 'Faxa_swndr' ) @@ -113,6 +124,7 @@ subroutine datm_datamode_cfsr_init_pointers(exportState, sdat, rc) ! initialize pointers for module level stream arrays call shr_strdata_get_stream_pointer( sdat, 'Sa_mask' , strm_mask , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! get export state pointers call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -126,9 +138,19 @@ subroutine datm_datamode_cfsr_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_shum' , fldptr1=Sa_shum , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_u10m' , fldptr1=Sa_u10m , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_v10m' , fldptr1=Sa_v10m , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_t2m' , fldptr1=Sa_t2m , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_q2m' , fldptr1=Sa_q2m , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_pslv' , fldptr1=Sa_pslv , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_rain' , fldptr1=Faxa_rain , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(exportState, 'Faxa_snow' , fldptr1=Faxa_snow , rc=rc) + call dshr_state_getfldptr(exportState, 'Faxa_snow' , fldptr1=Faxa_snow, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Faxa_swvdr' , fldptr1=Faxa_swvdr , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -187,6 +209,13 @@ subroutine datm_datamode_cfsr_advance(exportstate, masterproc, logunit, mpicom, end if do n = 1, lsize + !--- bottom layer height --- +! Sa_z(n) = 10.0_r8 + + !--- calculate wind speed --- +! if (associated(Sa_wspd)) then +! Sa_wspd(n) = sqrt(Sa_u(n)*Sa_u(n)+Sa_v(n)*Sa_v(n)) +! end if !--- temperature --- if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz @@ -196,9 +225,44 @@ subroutine datm_datamode_cfsr_advance(exportstate, masterproc, logunit, mpicom, end do !---------------------------------------------------------- - ! unit conversions (temporal resolution is 6-hourly) + ! unit conversions (temporal resolution is hourly) !---------------------------------------------------------- + ! convert J/m^2 to W/m^2 + !Faxa_lwdn(:) = Faxa_lwdn(:)/3600.0_r8 +! Faxa_lwdn(:) = Faxa_lwdn(:)/21600.0_r8 +! if (associated(Faxa_lwnet)) then +! Faxa_lwnet(:) = Faxa_lwnet(:)/3600.0_r8 +! end if +! Faxa_swdn(:) = Faxa_swdn(:)/3600.0_r8 +! Faxa_swdn(:) = Faxa_swdn(:)/21600.0_r8 + !Faxa_swvdr(:) = Faxa_swvdr(:)/3600.0_r8 + !Faxa_swndr(:) = Faxa_swndr(:)/3600.0_r8 + !Faxa_swvdf(:) = Faxa_swvdf(:)/3600.0_r8 + !Faxa_swndf(:) = Faxa_swndf(:)/3600.0_r8 +! Faxa_swvdr(:) = Faxa_swvdr(:)/21600.0_r8 +! Faxa_swndr(:) = Faxa_swndr(:)/21600.0_r8 +! Faxa_swvdf(:) = Faxa_swvdf(:)/21600.0_r8 +! Faxa_swndf(:) = Faxa_swndf(:)/21600.0_r8 +! Faxa_swnet(:) = Faxa_swnet(:)/3600.0_r8 +! Faxa_sen(:) = Faxa_sen(:)/3600.0_r8 +! Faxa_lat(:) = Faxa_lat(:)/3600.0_r8 + + ! convert m to kg/m^2/s + !Faxa_rain(:) = Faxa_rain(:)/3600.0_r8*rhofw +! Faxa_rain(:) = Faxa_rain(:)/21600.0_r8*rhofw +! Faxa_rainc(:) = Faxa_rainc(:)/3600.0_r8*rhofw +! Faxa_rainl(:) = Faxa_rainl(:)/3600.0_r8*rhofw +! Faxa_snowc(:) = Faxa_snowc(:)/3600.0_r8*rhofw + !Faxa_snow(:) = Faxa_snow(:)/3600.0_r8*rhofw +! Faxa_snow(:) = Faxa_snow(:)/21600.0_r8*rhofw + + ! convert N/m^2 s to N/m^2 +! Faxa_taux(:) = Faxa_taux(:)/3600.0_r8 +! Faxa_tauy(:) = Faxa_tauy(:)/3600.0_r8 +! Faxa_taux(:) = Faxa_taux(:)/21600.0_r8 +! Faxa_tauy(:) = Faxa_tauy(:)/21600.0_r8 + end subroutine datm_datamode_cfsr_advance !=============================================================================== diff --git a/dice/cime_config/buildnml b/dice/cime_config/buildnml index 7b925d5b4..aca70e45e 100755 --- a/dice/cime_config/buildnml +++ b/dice/cime_config/buildnml @@ -63,10 +63,15 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config = {} config['ice_grid'] = ice_grid config['dice_mode'] = dice_mode - config['scol_mode'] = 'true' if case.get_value('PTS_MODE') else 'false' - config['create_mesh'] = 'true' if case.get_value("ICE_DOMAIN_MESH") == 'create_mesh' else 'false' - scol_mode = True if case.get_value('PTS_MODE') else False - config['set_model_maskfile'] = 'true' if scol_mode or (ice_nx==atm_nx and ice_ny==atm_ny) else 'false' + config['set_model_maskfile'] = 'false' + if case.get_value('PTS_MODE'): + config['mode'] = 'single_column' + config['set_model_maskfile'] = 'true' + else: + config['mode'] = case.get_value("ICE_DOMAIN_MESH") + + if (ice_nx==atm_nx and ice_ny==atm_ny): + config['set_model_maskfile'] = 'true' # Initialize nmlgen nmlgen.init_defaults(infile, config) diff --git a/dice/cime_config/namelist_definition_dice.xml b/dice/cime_config/namelist_definition_dice.xml index fe18d508a..7f375bfc1 100644 --- a/dice/cime_config/namelist_definition_dice.xml +++ b/dice/cime_config/namelist_definition_dice.xml @@ -54,8 +54,8 @@ file specifying model mesh $ICE_DOMAIN_MESH - null - null + null + null @@ -68,10 +68,7 @@ file specifying model mask if not obtained from input model mesh - $ICE_DOMAIN_MESH - $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE - $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE - $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE + $MASK_MESH @@ -83,8 +80,8 @@ file specifying if model mesh is to be created at runtime null - $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE - $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE + $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE + $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE diff --git a/dlnd/cime_config/buildnml b/dlnd/cime_config/buildnml index e6176e3bd..667657784 100755 --- a/dlnd/cime_config/buildnml +++ b/dlnd/cime_config/buildnml @@ -62,9 +62,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['dlnd_mode'] = dlnd_mode config['create_mesh'] = 'true' if case.get_value("LND_DOMAIN_MESH") == 'create_mesh' else 'false' - # Do not allow single column mode for drof - scol_mode = True if case.get_value('PTS_MODE') else False - expect(not scol_mode, + # Do not allow single column mode for dlnd + expect(not case.get_value('PTS_MODE'), "for DLND, single column mode is not allowed") # Initialize nmlgen diff --git a/doc/source/streams.rst b/doc/source/streams.rst index c2f7d9073..743f31b65 100644 --- a/doc/source/streams.rst +++ b/doc/source/streams.rst @@ -219,15 +219,15 @@ where: over the forcing data for 1901-1920, and then run the model for years 1901-2010 using the forcing data from 1901-2010. To do this, initially set:: - ./xmlchange DATM_CLMNCEP_YR_ALIGN=1901 - ./xmlchange DATM_CLMNCEP_YR_START=1901 - ./xmlchange DATM_CLMNCEP_YR_END=1920 + ./xmlchange DATM_YR_ALIGN=1901 + ./xmlchange DATM_YR_START=1901 + ./xmlchange DATM_YR_END=1920 When the model has completed year 1900, set:: - ./xmlchange DATM_CLMNCEP_YR_ALIGN=1901 - ./xmlchange DATM_CLMNCEP_YR_START=1901 - ./xmlchange DATM_CLMNCEP_YR_END=2010 + ./xmlchange DATM_YR_ALIGN=1901 + ./xmlchange DATM_YR_START=1901 + ./xmlchange DATM_YR_END=2010 With this setup, the correlation between model run year and forcing year looks like this:: @@ -235,7 +235,7 @@ where: RUN Year : 1850 ... 1860 1861 ... 1870 ... 1880 1881 ... 1890 ... 1900 1901 ... 2010 FORCE Year : 1910 ... 1920 1901 ... 1910 ... 1920 1901 ... 1910 ... 1920 1901 ... 2010 - Setting ``DATM_CLMNCEP_YR_ALIGN`` to 1901 tells the code that you want + Setting ``DATM_YR_ALIGN`` to 1901 tells the code that you want to align model year 1901 with forcing data year 1901, and then it calculates what the forcing year should be if the model starts in year 1850. diff --git a/docn/cime_config/buildnml b/docn/cime_config/buildnml index e76b8d0c1..16066f7a3 100755 --- a/docn/cime_config/buildnml +++ b/docn/cime_config/buildnml @@ -69,7 +69,6 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['docn_mode'] = docn_mode config['create_mesh'] = 'true' if case.get_value("OCN_DOMAIN_MESH") == 'create_mesh' else 'false' config['aqua_planet'] = 'true' if 'aquap' in docn_mode else 'false' - scol_mode = True if case.get_value('PTS_MODE') else False nmlgen.init_defaults(infile, config) diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index cd7af94c0..aa5a050f5 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -119,8 +119,8 @@ $OCN_DOMAIN_MESH - null - null + null + null @@ -148,8 +148,8 @@ null - $OCN_DOMAIN_PATH/$OCN_DOMAIN_FILE - $OCN_DOMAIN_PATH/$OCN_DOMAIN_FILE + $OCN_DOMAIN_PATH/$OCN_DOMAIN_FILE + $OCN_DOMAIN_PATH/$OCN_DOMAIN_FILE diff --git a/drof/cime_config/buildnml b/drof/cime_config/buildnml index 316b46906..f7d567504 100755 --- a/drof/cime_config/buildnml +++ b/drof/cime_config/buildnml @@ -63,8 +63,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['create_mesh'] = 'true' if case.get_value("ROF_DOMAIN_MESH") == 'create_mesh' else 'false' # Do not allow single column mode for drof - scol_mode = True if case.get_value('PTS_MODE') else False - expect(not scol_mode, + expect(not case.get_value('PTS_MODE'), "for, DROF single column mode is not allowed") # Initialize nmlgen diff --git a/dwav/cime_config/buildnml b/dwav/cime_config/buildnml index 88e4b19cd..5f9f508c8 100755 --- a/dwav/cime_config/buildnml +++ b/dwav/cime_config/buildnml @@ -61,8 +61,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['dwav_mode'] = dwav_mode # do not allow single column mode for dwav - scol_mode = True if case.get_value('PTS_MODE') else False - expect(not scol_mode, + expect(not case.get_value('PTS_MODE'), "for, DWAV single column mode is not allowed") # Initialize nmlgen From 8bbb84feeec5247ef60a74fa66433153a88bf4db Mon Sep 17 00:00:00 2001 From: BinLi-NOAA Date: Thu, 4 Mar 2021 11:47:43 -0500 Subject: [PATCH 05/10] Update CDEPS to the latest ESCOMP/CDEPS master branch (#12) This update includes component-level PIO initialization feature from the ESCOMP/CDEPS master branch. --- CMakeLists.txt | 2 +- datm/atm_comp_nuopc.F90 | 4 +- dice/ice_comp_nuopc.F90 | 4 +- dlnd/lnd_comp_nuopc.F90 | 4 +- docn/ocn_comp_nuopc.F90 | 4 +- drof/rof_comp_nuopc.F90 | 4 +- dshr/dshr_mod.F90 | 492 +++++++++++++++++-- dwav/wav_comp_nuopc.F90 | 4 +- share/CMakeLists.txt | 1 - share/shr_pio_mod.F90 | 912 ----------------------------------- streams/dshr_strdata_mod.F90 | 12 +- streams/dshr_stream_mod.F90 | 36 +- 12 files changed, 505 insertions(+), 974 deletions(-) delete mode 100644 share/shr_pio_mod.F90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1996e8525..733855ab2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ if (DEFINED CIMEROOT) set(CMAKE_Fortran_COMPILER ${MPIFC}) set(CMAKE_CXX_COMPILER ${MPICXX}) endif() - set(CMAKE_Fortran_FLAGS "${FFLAGS} -I${LIBROOT}/include -I${LIBROOT}/finclude -I${LIBROOT}/nuopc/esmf/${NINST_VALUE}/include") + set(CMAKE_Fortran_FLAGS "${FFLAGS} ${CPPDEFS} -I${LIBROOT}/include -I${LIBROOT}/finclude -I${LIBROOT}/nuopc/esmf/${NINST_VALUE}/include") else() set(BLD_STANDALONE TRUE) endif() diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index 6c69e9f25..f1ade377b 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -223,7 +223,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Obtain flds_scalar values, mpi values, multi-instance values and ! set logunit and set shr logging to my log file - call dshr_init(gcomp, mpicom, my_task, inst_index, inst_suffix, & + call dshr_init(gcomp, 'ATM', sdat, mpicom, my_task, inst_index, inst_suffix, & flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, & logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -376,7 +376,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, compid, and logunit call ESMF_TraceRegionEnter('datm_strdata_init') - call dshr_mesh_init(gcomp, nullstr, logunit, 'ATM', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ATM', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index de243e597..4fd0fa5f9 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -180,7 +180,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Obtain flds_scalar values, mpi values, multi-instance values and ! set logunit and set shr logging to my log file - call dshr_init(gcomp, mpicom, my_task, inst_index, inst_suffix, & + call dshr_init(gcomp, 'ICE', sdat, mpicom, my_task, inst_index, inst_suffix, & flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, & logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -301,7 +301,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, logunit call ESMF_TraceRegionEnter('dice_strdata_init') - call dshr_mesh_init(gcomp, nullstr, logunit, 'ICE', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ICE', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/dlnd/lnd_comp_nuopc.F90 b/dlnd/lnd_comp_nuopc.F90 index 566b80441..5e0cc6c92 100644 --- a/dlnd/lnd_comp_nuopc.F90 +++ b/dlnd/lnd_comp_nuopc.F90 @@ -175,7 +175,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Obtain flds_scalar values, mpi values, multi-instance values and ! set logunit and set shr logging to my log file - call dshr_init(gcomp, mpicom, my_task, inst_index, inst_suffix, & + call dshr_init(gcomp, 'LND', sdat, mpicom, my_task, inst_index, inst_suffix, & flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, & logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -282,7 +282,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize sdat call ESMF_TraceRegionEnter('dlnd_strdata_init') - call dshr_mesh_init(gcomp, nullstr, logunit, 'LND', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'LND', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 6a73b1043..b6c3b15e7 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -191,7 +191,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Obtain flds_scalar values, mpi values, multi-instance values and ! set logunit and set shr logging to my log file - call dshr_init(gcomp, mpicom, my_task, inst_index, inst_suffix, & + call dshr_init(gcomp, 'OCN', sdat, mpicom, my_task, inst_index, inst_suffix, & flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, logunit, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -322,7 +322,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize model mesh, restart flag, logunit, model_mask and model_frac call ESMF_TraceRegionEnter('docn_strdata_init') - call dshr_mesh_init(gcomp, nullstr, logunit, 'OCN', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'OCN', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index aef47ee01..27c0139d1 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -171,7 +171,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Obtain flds_scalar values, mpi values, multi-instance values and ! set logunit and set shr logging to my log file - call dshr_init(gcomp, mpicom, my_task, inst_index, inst_suffix, & + call dshr_init(gcomp, 'ROF', sdat, mpicom, my_task, inst_index, inst_suffix, & flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, & logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -279,7 +279,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, logunit call ESMF_TraceRegionEnter('drof_strdata_init') - call dshr_mesh_init(gcomp, nullstr, logunit, 'ROF', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ROF', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/dshr/dshr_mod.F90 b/dshr/dshr_mod.F90 index eec384601..0ad235a1e 100644 --- a/dshr/dshr_mod.F90 +++ b/dshr/dshr_mod.F90 @@ -30,6 +30,7 @@ module dshr_mod use ESMF , only : ESMF_RouteHandle, ESMF_FieldRegrid use ESMF , only : ESMF_TERMORDER_SRCSEQ, ESMF_FieldRegridStore, ESMF_SparseMatrixWrite use ESMF , only : ESMF_Region_Flag, ESMF_REGION_TOTAL, ESMF_MAXSTR, ESMF_RC_NOT_VALID + use ESMF , only : ESMF_UtilStringUpperCase use shr_kind_mod , only : r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl, cxx=>shr_kind_cxx, i8=>shr_kind_i8 use shr_sys_mod , only : shr_sys_abort use shr_mpi_mod , only : shr_mpi_bcast @@ -37,7 +38,9 @@ module dshr_mod use shr_cal_mod , only : shr_cal_datetod2string, shr_cal_date2julian use shr_const_mod , only : shr_const_spval, shr_const_cday use shr_orb_mod , only : shr_orb_params, SHR_ORB_UNDEF_INT, SHR_ORB_UNDEF_REAL +#ifdef CESMCOUPLED use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat +#endif use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_xml, SHR_STRDATA_GET_STREAM_COUNT use dshr_methods_mod , only : chkerr use pio @@ -100,21 +103,23 @@ subroutine dshr_model_initphase(gcomp, importState, exportState, clock, rc) end subroutine dshr_model_initphase !=============================================================================== - subroutine dshr_init(gcomp, mpicom, my_task, inst_index, inst_suffix, & + subroutine dshr_init(gcomp, compname, sdat, mpicom, my_task, inst_index, inst_suffix, & flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, logunit, rc) ! input/output variables - type(ESMF_GridComp) :: gcomp - integer , intent(inout) :: mpicom - integer , intent(out) :: my_task - integer , intent(out) :: inst_index - character(len=*) , intent(out) :: inst_suffix - character(len=*) , intent(out) :: flds_scalar_name - integer , intent(out) :: flds_scalar_num - integer , intent(out) :: flds_scalar_index_nx - integer , intent(out) :: flds_scalar_index_ny - integer , intent(out) :: logunit - integer , intent(out) :: rc + type(ESMF_GridComp) :: gcomp + character(len=*) , intent(in) :: compname !e.g. ATM, OCN, ... + type(shr_strdata_type), intent(inout) :: sdat + integer , intent(inout) :: mpicom + integer , intent(out) :: my_task + integer , intent(out) :: inst_index + character(len=*) , intent(out) :: inst_suffix + character(len=*) , intent(out) :: flds_scalar_name + integer , intent(out) :: flds_scalar_num + integer , intent(out) :: flds_scalar_index_nx + integer , intent(out) :: flds_scalar_index_ny + integer , intent(out) :: logunit + integer , intent(out) :: rc ! local variables type(ESMF_VM) :: vm @@ -195,10 +200,18 @@ subroutine dshr_init(gcomp, mpicom, my_task, inst_index, inst_suffix, & inst_index=1 endif +#ifdef CESMCOUPLED + sdat%pio_subsystem => shr_pio_getiosys(trim(compname)) + sdat%io_type = shr_pio_getiotype(trim(compname)) + sdat%io_format = shr_pio_getioformat(trim(compname)) +#else + call dshr_pio_init(gcomp, sdat, logunit, rc) +#endif + end subroutine dshr_init !=============================================================================== - subroutine dshr_mesh_init(gcomp, nullstr, logunit, compname, model_nxg, model_nyg, & + subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, model_nyg, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, read_restart, rc) @@ -207,7 +220,8 @@ subroutine dshr_mesh_init(gcomp, nullstr, logunit, compname, model_nxg, model_ny ! ---------------------------------------------- ! input/output variables - type(ESMF_GridComp), intent(inout) :: gcomp + type(ESMF_GridComp) , intent(inout) :: gcomp + type(shr_strdata_type) , intent(in) :: sdat integer , intent(in) :: logunit character(len=*) , intent(in) :: compname !e.g. ATM, OCN, ... character(len=*) , intent(in) :: nullstr @@ -238,10 +252,6 @@ subroutine dshr_mesh_init(gcomp, nullstr, logunit, compname, model_nxg, model_ny type(ESMF_Array) :: elemMaskArray type(file_desc_t) :: pioid type(var_desc_t) :: varid - type(io_desc_t) :: pio_iodesc - type(iosystem_desc_t), pointer :: pio_subsystem => null() ! pio info - integer :: io_type ! pio info - integer :: io_format ! pio info integer :: rcode logical :: isPresent, isSet logical :: masterproc @@ -322,7 +332,7 @@ subroutine dshr_mesh_init(gcomp, nullstr, logunit, compname, model_nxg, model_ny ! Now create the model meshfile call dshr_mesh_create(trim(model_createmesh_fromfile), scol_mode, scol_lon, scol_lat, & - trim(compname), my_task, logunit, model_mesh, model_mask, model_frac, rc=rc) + trim(compname), sdat, my_task, logunit, model_mesh, model_mask, model_frac, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else @@ -379,28 +389,26 @@ end subroutine dshr_mesh_init !=============================================================================== subroutine dshr_mesh_create(filename, scol_mode, scol_lon, scol_lat, & - compname, my_task, logunit, model_mesh, model_mask, model_frac, rc) + compname, sdat, my_task, logunit, model_mesh, model_mask, model_frac, rc) ! Create the model mesh from the domain file - for either single column mode ! or for a regional grid ! input/output variables - character(len=*) , intent(in) :: filename - logical , intent(in) :: scol_mode - real(r8) , intent(inout) :: scol_lon - real(r8) , intent(inout) :: scol_lat - character(len=*) , intent(in) :: compname - integer , intent(in) :: my_task - integer , intent(in) :: logunit - type(ESMF_Mesh) , intent(out) :: model_mesh - integer , pointer , intent(out) :: model_mask(:) - real(r8), pointer , intent(out) :: model_frac(:) - integer , intent(out) :: rc + character(len=*) , intent(in) :: filename + logical , intent(in) :: scol_mode + real(r8) , intent(inout) :: scol_lon + real(r8) , intent(inout) :: scol_lat + character(len=*) , intent(in) :: compname + type(shr_strdata_type), intent(in) :: sdat + integer , intent(in) :: my_task + integer , intent(in) :: logunit + type(ESMF_Mesh) , intent(out) :: model_mesh + integer , pointer , intent(out) :: model_mask(:) + real(r8), pointer , intent(out) :: model_frac(:) + integer , intent(out) :: rc ! local variables - type(iosystem_desc_t), pointer :: pio_subsystem => null() ! pio info - integer :: io_type ! pio info - integer :: io_format ! pio info type(file_desc_t) :: pioid integer :: rcode ! error code type(var_desc_t) :: varid ! variable id @@ -431,15 +439,11 @@ subroutine dshr_mesh_create(filename, scol_mode, scol_lon, scol_lat, & rc = ESMF_SUCCESS - pio_subsystem => shr_pio_getiosys(trim(compname)) - io_type = shr_pio_getiotype(trim(compname)) - io_format = shr_pio_getioformat(trim(compname)) - !------------------------------------- ! open domain file and get dimensions !------------------------------------- - rcode = pio_openfile(pio_subsystem, pioid, io_type, trim(filename), pio_nowrite) + rcode = pio_openfile(sdat%pio_subsystem, pioid, sdat%io_type, trim(filename), pio_nowrite) call pio_check_err(rcode, 'error opening file '//trim(filename)) call PIO_seterrorhandling(pioid, PIO_BCAST_ERROR) @@ -1691,4 +1695,414 @@ subroutine dshr_set_modelmask(mesh_dst, meshfile_mask, compname, mask_dst, frac_ end subroutine dshr_set_modelmask + subroutine dshr_pio_init(gcomp, sdat, logunit, rc) + + ! ---------------------------------------------- + ! Initialize PIO + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_GridComp) , intent(in) :: gcomp + type(shr_strdata_type), intent(inout) :: sdat + integer , intent(in) :: logunit + integer , intent(out) :: rc + + ! local variables: + type(ESMF_VM) :: vm + integer :: mpicom, my_task, petCount + integer :: pio_numiotasks + integer :: pio_stride + integer :: pio_rearranger + integer :: pio_root + integer :: pio_debug_level + integer :: pio_rearr_comm_type + integer :: pio_rearr_comm_fcd + logical :: pio_rearr_comm_enable_hs_comp2io + logical :: pio_rearr_comm_enable_isend_comp2io + integer :: pio_rearr_comm_max_pend_req_comp2io + logical :: pio_rearr_comm_enable_hs_io2comp + logical :: pio_rearr_comm_enable_isend_io2comp + integer :: pio_rearr_comm_max_pend_req_io2comp + logical :: isPresent, isSet, ret + character(len=CL) :: cvalue + character(len=CS) :: cname + character(len=CL) :: logmsg + character(len=CL) :: diro + character(len=CL) :: logfile + character(len=*),parameter :: subname='(dshr_pio_init)' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! generate local mpi comm + call ESMF_GridCompGet(gcomp, vm=vm, name=cname, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_VMGet(vm, mpiCommunicator=mpicom, localPet=my_task, & + petCount=petCount, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! query component specific PIO attributes + ! pio_netcdf_format + call NUOPC_CompAttributeGet(gcomp, name='pio_netcdf_format', value=cvalue, & + isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + cvalue = ESMF_UtilStringUpperCase(cvalue) + if (trim(cvalue) .eq. 'CLASSIC') then + sdat%io_format = 0 + else if (trim(cvalue) .eq. '64BIT_OFFSET') then + sdat%io_format = PIO_64BIT_OFFSET + else if (trim(cvalue) .eq. '64BIT_DATA') then + sdat%io_format = PIO_64BIT_DATA + else + call ESMF_LogWrite(trim(subname)//'-'//trim(cname)// & + ' : need to provide valid option for pio_ioformat & + (CLASSIC|64BIT_OFFSET|64BIT_DATA)', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + else + cvalue = '64BIT_OFFSET' + sdat%io_format = PIO_64BIT_OFFSET + end if + if (my_task == master_task) write(logunit,*) trim(subname)//' : pio_netcdf_format = ', & + trim(cvalue), sdat%io_format + + ! pio_typename + call NUOPC_CompAttributeGet(gcomp, name='pio_typename', value=cvalue, & + isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + cvalue = ESMF_UtilStringUpperCase(cvalue) + if (trim(cvalue) .eq. 'NETCDF') then + sdat%io_type = PIO_IOTYPE_NETCDF + else if (trim(cvalue) .eq. 'PNETCDF') then + sdat%io_type = PIO_IOTYPE_PNETCDF + else if (trim(cvalue) .eq. 'NETCDF4C') then + sdat%io_type = PIO_IOTYPE_NETCDF4C + else if (trim(cvalue) .eq. 'NETCDF4P') then + sdat%io_type = PIO_IOTYPE_NETCDF4P + else + call ESMF_LogWrite(trim(subname)//'-'//trim(cname)// & + ' : need to provide valid option for pio_typename & + (NETCDF|PNETCDF|NETCDF4C|NETCDF4P)', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + else + cvalue = 'NETCDF' + sdat%io_type = PIO_IOTYPE_NETCDF + end if + if (my_task == master_task) write(logunit,*) trim(subname)//' : pio_typename = ', & + trim(cvalue), sdat%io_type + + ! pio_root + call NUOPC_CompAttributeGet(gcomp, name='pio_root', value=cvalue, & + isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + read(cvalue,*) pio_root + if (pio_root < 0) then + pio_root = 1 + endif + pio_root = min(pio_root, petCount-1) + else + pio_root = 1 + end if + if (my_task == master_task) write(logunit,*) trim(subname)//' : pio_root = ', & + pio_root + + ! pio_stride + call NUOPC_CompAttributeGet(gcomp, name='pio_stride', value=cvalue, & + isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + read(cvalue,*) pio_stride + else + pio_stride = -99 + end if + if (my_task == master_task) write(logunit,*) trim(subname)//' : pio_stride = ', & + pio_stride + + ! pio_numiotasks + call NUOPC_CompAttributeGet(gcomp, name='pio_numiotasks', value=cvalue, & + isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + read(cvalue,*) pio_numiotasks + else + pio_numiotasks = -99 + end if + if (my_task == master_task) write(logunit,*) trim(subname)//' : pio_numiotasks = ', & + pio_numiotasks + + ! check for parallel IO, it requires at least two io pes + if (petCount > 1 .and. pio_numiotasks == 1 .and. & + (sdat%io_type .eq. PIO_IOTYPE_PNETCDF .or. & + sdat%io_type .eq. PIO_IOTYPE_NETCDF4P)) then + pio_numiotasks = 2 + pio_stride = min(pio_stride, petCount/2) + if (my_task == master_task) then + write(logunit,*) ' parallel io requires at least two io pes - following parameters are updated:' + write(logunit,*) trim(subname)//' : pio_stride = ', pio_stride + write(logunit,*) trim(subname)//' : pio_numiotasks = ', pio_numiotasks + end if + endif + + ! check/set/correct io pio parameters + if (pio_stride > 0 .and. pio_numiotasks < 0) then + pio_numiotasks = max(1, petCount/pio_stride) + if (my_task == master_task) write(logunit,*) trim(subname)//' : update pio_numiotasks = ', pio_numiotasks + else if(pio_numiotasks > 0 .and. pio_stride < 0) then + pio_stride = max(1, petCount/pio_numiotasks) + if (my_task == master_task) write(logunit,*) trim(subname)//' : update pio_stride = ', pio_stride + else if(pio_numiotasks < 0 .and. pio_stride < 0) then + pio_stride = max(1,petCount/4) + pio_numiotasks = max(1,petCount/pio_stride) + if (my_task == master_task) write(logunit,*) trim(subname)//' : update pio_numiotasks = ', pio_numiotasks + if (my_task == master_task) write(logunit,*) trim(subname)//' : update pio_stride = ', pio_stride + end if + if (pio_stride == 1) then + pio_root = 0 + endif + + if (pio_root + (pio_stride)*(pio_numiotasks-1) >= petCount .or. & + pio_stride <= 0 .or. pio_numiotasks <= 0 .or. & + pio_root < 0 .or. pio_root > petCount-1) then + if (petCount < 100) then + pio_stride = max(1, petCount/4) + else if(petCount < 1000) then + pio_stride = max(1, petCount/8) + else + pio_stride = max(1, petCount/16) + end if + if(pio_stride > 1) then + pio_numiotasks = petCount/pio_stride + pio_root = min(1, petCount-1) + else + pio_numiotasks = petCount + pio_root = 0 + end if + if (my_task == master_task) then + write(logunit,*) 'pio_stride, iotasks or root out of bounds - resetting to defaults:' + write(logunit,*) trim(subname)//' : pio_root = ', pio_root + write(logunit,*) trim(subname)//' : pio_stride = ', pio_stride + write(logunit,*) trim(subname)//' : pio_numiotasks = ', pio_numiotasks + end if + end if + + ! init PIO + allocate(sdat%pio_subsystem) + if (my_task == master_task) write(logunit,*) trim(subname)//' : calling pio init' + call pio_init(my_task, mpicom, pio_numiotasks, 0, pio_stride, & + pio_rearranger, sdat%pio_subsystem, base=pio_root) + + ! PIO debug related options + ! pio_debug_level + call NUOPC_CompAttributeGet(gcomp, name='pio_debug_level', value=cvalue, & + isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + read(cvalue,*) pio_debug_level + if (pio_debug_level < 0 .or. pio_debug_level > 6) then + call ESMF_LogWrite(trim(subname)//': need to provide valid option for & + pio_debug_level (0-6)', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + else + pio_debug_level = 0 + end if + if (my_task == master_task) write(logunit,*) trim(subname), & + ' : pio_debug_level = ',pio_debug_level + + ! set PIO debug level + call pio_setdebuglevel(pio_debug_level) + + ! pio_rearranger + call NUOPC_CompAttributeGet(gcomp, name='pio_rearranger', value=cvalue, & + isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (isPresent .and. isSet) then + cvalue = ESMF_UtilStringUpperCase(cvalue) + if (trim(cvalue) .eq. 'BOX') then + pio_rearranger = PIO_REARR_BOX + else if (trim(cvalue) .eq. 'SUBSET') then + pio_rearranger = PIO_REARR_SUBSET + else + call ESMF_LogWrite(trim(subname)//'-'//trim(cname)// & + ' : need to provide valid option for pio_rearranger & + (BOX|SUBSET)', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + else + cvalue = 'BOX' + pio_rearranger = PIO_REARR_BOX + end if + if (my_task == master_task) write(logunit,*) trim(subname)//' : pio_rearranger = ', & + trim(cvalue), pio_rearranger + + ! init PIO + allocate(sdat%pio_subsystem) + if (my_task == master_task) write(logunit,*) trim(subname)//' : calling pio init' + call pio_init(my_task, mpicom, pio_numiotasks, 0, pio_stride, & + pio_rearranger, sdat%pio_subsystem, base=pio_root) + + ! query shared PIO rearranger attributes + ! pio_rearr_comm_type + call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_type', value=cvalue, & + isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + cvalue = ESMF_UtilStringUpperCase(cvalue) + if (trim(cvalue) .eq. 'P2P') then + pio_rearr_comm_type = PIO_REARR_COMM_P2P + else if (trim(cvalue) .eq. 'COLL') then + pio_rearr_comm_type = PIO_REARR_COMM_COLL + else + call ESMF_LogWrite(trim(subname)//' : need to provide valid option for & + pio_rearr_comm_type (P2P|COLL)', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + else + cvalue = 'P2P' + pio_rearr_comm_type = PIO_REARR_COMM_P2P + end if + if (my_task == master_task) write(logunit,*) trim(subname)// & + ' : pio_rearr_comm_type = ', trim(cvalue), pio_rearr_comm_type + + ! pio_rearr_comm_fcd + call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_fcd', value=cvalue, & + isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + cvalue = ESMF_UtilStringUpperCase(cvalue) + if (trim(cvalue) .eq. '2DENABLE') then + pio_rearr_comm_fcd = PIO_REARR_COMM_FC_2D_ENABLE + else if (trim(cvalue) .eq. 'IO2COMP') then + pio_rearr_comm_fcd = PIO_REARR_COMM_FC_1D_IO2COMP + else if (trim(cvalue) .eq. 'COMP2IO') then + pio_rearr_comm_fcd = PIO_REARR_COMM_FC_1D_COMP2IO + else if (trim(cvalue) .eq. '2DDISABLE') then + pio_rearr_comm_fcd = PIO_REARR_COMM_FC_2D_DISABLE + else + call ESMF_LogWrite(trim(subname)//' : need to provide valid option for & + pio_rearr_comm_fcd (2DENABLE|IO2COMP|COMP2IO|2DDISABLE)', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + else + cvalue = '2DENABLE' + pio_rearr_comm_fcd = PIO_REARR_COMM_FC_2D_ENABLE + end if + if (my_task == master_task) write(logunit,*) trim(subname)// & + ' : pio_rearr_comm_fcd = ', trim(cvalue), pio_rearr_comm_fcd + + ! pio_rearr_comm_enable_hs_comp2io + call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_enable_hs_comp2io', & + value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + read(cvalue,*) pio_rearr_comm_enable_hs_comp2io + else + pio_rearr_comm_enable_hs_comp2io = .true. + end if + + ! pio_rearr_comm_enable_isend_comp2io + call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_enable_isend_comp2io', & + value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + read(cvalue,*) pio_rearr_comm_enable_isend_comp2io + else + pio_rearr_comm_enable_isend_comp2io = .false. + end if + + ! pio_rearr_comm_max_pend_req_comp2io + call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_max_pend_req_comp2io', & + value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + read(cvalue,*) pio_rearr_comm_max_pend_req_comp2io + else + pio_rearr_comm_max_pend_req_comp2io = 0 + end if + + ! pio_rearr_comm_enable_hs_io2comp + call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_enable_hs_io2comp', & + value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + read(cvalue,*) pio_rearr_comm_enable_hs_io2comp + else + pio_rearr_comm_enable_hs_io2comp = .false. + end if + + ! pio_rearr_comm_enable_isend_io2comp + call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_enable_isend_io2comp', & + value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + read(cvalue,*) pio_rearr_comm_enable_isend_io2comp + else + pio_rearr_comm_enable_isend_io2comp = .true. + end if + + ! pio_rearr_comm_max_pend_req_io2comp + call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_max_pend_req_io2comp', & + value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (isPresent .and. isSet) then + read(cvalue,*) pio_rearr_comm_max_pend_req_io2comp + else + pio_rearr_comm_max_pend_req_io2comp = 64 + end if + + ! print out PIO rearranger parameters + if (my_task == master_task) then + write(logunit,*) trim(subname)//' : pio_rearr_comm_enable_hs_comp2io = ', & + pio_rearr_comm_enable_hs_comp2io + write(logunit,*) trim(subname)//' : pio_rearr_comm_enable_isend_comp2io = ', & + pio_rearr_comm_enable_isend_comp2io + write(logunit,*) trim(subname)//' : pio_rearr_comm_max_pend_req_comp2io = ', & + pio_rearr_comm_max_pend_req_comp2io + write(logunit,*) trim(subname)//' : pio_rearr_comm_enable_hs_io2comp = ', & + pio_rearr_comm_enable_hs_io2comp + write(logunit,*) trim(subname)//' : pio_rearr_comm_enable_isend_io2comp = ', & + pio_rearr_comm_enable_isend_io2comp + write(logunit,*) trim(subname)//' : pio_rearr_comm_max_pend_req_io2comp = ', & + pio_rearr_comm_max_pend_req_io2comp + end if + + ! set PIO rearranger options + if (my_task == master_task) write(logunit,*) trim(subname)// & + ' calling pio_set_rearr_opts' + ret = pio_set_rearr_opts(sdat%pio_subsystem, pio_rearr_comm_type, & + pio_rearr_comm_fcd, & + pio_rearr_comm_enable_hs_comp2io, & + pio_rearr_comm_enable_isend_comp2io, & + pio_rearr_comm_max_pend_req_comp2io, & + pio_rearr_comm_enable_hs_io2comp, & + pio_rearr_comm_enable_isend_io2comp, & + pio_rearr_comm_max_pend_req_io2comp) + + end subroutine dshr_pio_init + end module dshr_mod diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index a6aa72243..70f360d45 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -170,7 +170,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Obtain flds_scalar values, mpi values, multi-instance values and ! set logunit and set shr logging to my log file - call dshr_init(gcomp, mpicom, my_task, inst_index, inst_suffix, & + call dshr_init(gcomp, 'WAV', sdat, mpicom, my_task, inst_index, inst_suffix, & flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, & logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -267,7 +267,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize sdat - create the model domain mesh and intialize the sdat clock call ESMF_TraceRegionEnter('dwav_strdata_init') - call dshr_mesh_init(gcomp, nullstr, logunit, 'WAV', nx_global, ny_global, & + call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'WAV', nx_global, ny_global, & model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index cc71a4217..d24e8f93c 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -9,7 +9,6 @@ add_library(cdeps_share ${GenF90_SRCS} shr_timer_mod.F90 shr_cal_mod.F90 shr_kind_mod.F90 - shr_pio_mod.F90 shr_sys_mod.F90 shr_abort_mod.F90 shr_const_mod.F90 diff --git a/share/shr_pio_mod.F90 b/share/shr_pio_mod.F90 deleted file mode 100644 index 73ee46b2f..000000000 --- a/share/shr_pio_mod.F90 +++ /dev/null @@ -1,912 +0,0 @@ -module shr_pio_mod - use pio - use shr_kind_mod, only : shr_kind_CS, shr_kind_cl, shr_kind_in - use shr_log_mod, only : shr_log_unit - use shr_mpi_mod, only : shr_mpi_bcast, shr_mpi_chkerr - use shr_sys_mod, only : shr_sys_abort -#ifndef NO_MPIMOD - use mpi, only : mpi_comm_null, mpi_comm_world -#endif - implicit none -#ifdef NO_MPIMOD -#include -#endif - private - public :: shr_pio_init1 - public :: shr_pio_init2 - public :: shr_pio_getiosys - public :: shr_pio_getiotype - public :: shr_pio_getioroot - public :: shr_pio_finalize - public :: shr_pio_getioformat - public :: shr_pio_getrearranger - - interface shr_pio_getiotype - module procedure shr_pio_getiotype_fromid, shr_pio_getiotype_fromname - end interface - interface shr_pio_getioformat - module procedure shr_pio_getioformat_fromid, shr_pio_getioformat_fromname - end interface - interface shr_pio_getiosys - module procedure shr_pio_getiosys_fromid, shr_pio_getiosys_fromname - end interface - interface shr_pio_getioroot - module procedure shr_pio_getioroot_fromid, shr_pio_getioroot_fromname - end interface - interface shr_pio_getindex - module procedure shr_pio_getindex_fromid, shr_pio_getindex_fromname - end interface - interface shr_pio_getrearranger - module procedure shr_pio_getrearranger_fromid, shr_pio_getrearranger_fromname - end interface - - - - type pio_comp_t - integer :: compid - integer :: pio_root - integer :: pio_stride - integer :: pio_numiotasks - integer :: pio_iotype - integer :: pio_rearranger - integer :: pio_netcdf_ioformat - end type pio_comp_t - - character(len=16), allocatable :: io_compname(:) - type(pio_comp_t), allocatable :: pio_comp_settings(:) - type (iosystem_desc_t), allocatable, target :: iosystems(:) - integer :: io_comm - logical :: pio_async_interface - integer, allocatable :: io_compid(:) - integer :: pio_debug_level=0, pio_blocksize=0 - integer(kind=pio_offset_kind) :: pio_buffer_size_limit=-1 - integer :: pio_rearr_opt_comm_type, pio_rearr_opt_fcd - logical :: pio_rearr_opt_c2i_enable_hs, pio_rearr_opt_c2i_enable_isend - integer :: pio_rearr_opt_c2i_max_pend_req - logical :: pio_rearr_opt_i2c_enable_hs, pio_rearr_opt_i2c_enable_isend - integer :: pio_rearr_opt_i2c_max_pend_req - integer :: total_comps=0 - -#define DEBUGI 1 - -#ifdef DEBUGI - integer :: drank -#endif - - -contains -!> -!! @public -!! @brief should be the first routine called after mpi_init. -!! It reads the pio default settings from file drv_in, namelist pio_default_inparm -!! and, if pio_async_interface is true, splits the IO tasks away from the -!! Compute tasks. It then returns the new compute comm in -!! Global_Comm and sets module variable io_comm. -!! -!< - subroutine shr_pio_init1(ncomps, nlfilename, Global_Comm) - integer, intent(in) :: ncomps - character(len=*) :: nlfilename - integer, intent(inout) :: Global_Comm - - - integer :: i, pio_root, pio_stride, pio_numiotasks, pio_iotype, pio_rearranger, pio_netcdf_ioformat - integer :: mpigrp_world, mpigrp, ierr, mpicom - character(*),parameter :: subName = '(shr_pio_init1) ' - integer :: pelist(3,1) - - call shr_pio_read_default_namelist(nlfilename, Global_Comm, pio_stride, pio_root, pio_numiotasks, & - pio_iotype, pio_async_interface, pio_rearranger) - - pio_netcdf_ioformat = PIO_64BIT_OFFSET - call MPI_comm_rank(Global_Comm, drank, ierr) - - io_comm = MPI_COMM_NULL - allocate(pio_comp_settings(ncomps)) - do i=1,ncomps - pio_comp_settings(i)%pio_root = pio_root - pio_comp_settings(i)%pio_stride = pio_stride - pio_comp_settings(i)%pio_numiotasks = pio_numiotasks - pio_comp_settings(i)%pio_iotype = pio_iotype - pio_comp_settings(i)%pio_rearranger = pio_rearranger - pio_comp_settings(i)%pio_netcdf_ioformat = pio_netcdf_ioformat - end do - if(pio_async_interface) then -#ifdef NO_MPI2 - call shr_sys_abort(subname//':: async IO requires an MPI2 compliant MPI library') -#else - - pelist(1,1) = pio_root - pelist(2,1) = pio_root + (pio_numiotasks-1)*pio_stride - pelist(3,1) = pio_stride - - call mpi_comm_group(GLOBAL_COMM, mpigrp_world, ierr) - call shr_mpi_chkerr(ierr,subname//' mpi_comm_group mpigrp_world') - call mpi_group_range_incl(mpigrp_world, 1, pelist, mpigrp,ierr) - call shr_mpi_chkerr(ierr,subname//' mpi_group_range_incl mpigrp') - call mpi_comm_create(GLOBAL_COMM, mpigrp, io_comm, ierr) - - call mpi_group_range_excl(mpigrp_world, 1, pelist, mpigrp,ierr) - call shr_mpi_chkerr(ierr,subname//' mpi_group_range_incl mpigrp') - call mpi_comm_create(GLOBAL_COMM, mpigrp, mpicom, ierr) - Global_COMM=mpicom - - print *,__FILE__,__LINE__,subname, ' complete' -#endif - end if - total_comps = ncomps - end subroutine shr_pio_init1 -!> -!! @public -!! @brief if pio_async_interface is true, tasks in io_comm do not return from this subroutine. -!! -!! if pio_async_interface is false each component namelist pio_inparm is read from compname_modelio.nml -!! Then a subset of each components compute tasks are Identified as IO tasks using the root, stride and count -!! variables to select the tasks. -!! -!< - - - subroutine shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) - use shr_string_mod, only : shr_string_toLower - integer, intent(in) :: comp_id(:) - logical, intent(in) :: comp_iamin(:) - character(len=*), intent(in) :: comp_name(:) - integer, intent(in) :: comp_comm(:), comp_comm_iam(:) - integer :: i - character(len=shr_kind_cl) :: nlfilename, cname - integer :: ret - character(*), parameter :: subName = '(shr_pio_init2) ' - - if(pio_debug_level>0) then - if(comp_comm_iam(1)==0) then - write(shr_log_unit,*) 'Setting pio_debuglevel : ',pio_debug_level - end if - call pio_setdebuglevel(pio_debug_level) - endif - ! 0 is a valid value of pio_buffer_size_limit - if(pio_buffer_size_limit>=0) then - if(comp_comm_iam(1)==0) then - write(shr_log_unit,*) 'Setting pio_buffer_size_limit : ',pio_buffer_size_limit - end if - call pio_set_buffer_size_limit(pio_buffer_size_limit) - endif - if(pio_blocksize>0) then - if(comp_comm_iam(1)==0) then - write(shr_log_unit,*) 'Setting pio_blocksize : ',pio_blocksize - end if - call pio_set_blocksize(pio_blocksize) - endif - ! Correct the total_comps value which may be lower in nuopc - total_comps = size(comp_iamin) - - - allocate(io_compid(total_comps), io_compname(total_comps)) - - io_compid = comp_id - io_compname = comp_name - allocate(iosystems(total_comps)) - - if(pio_async_interface) then - call shr_sys_abort('pio_async_interface is not currently supported') -! call pio_init(total_comps,mpi_comm_world, comp_comm, io_comm, iosystems) -! do i=1,total_comps -! ret = pio_set_rearr_opts(iosystems(i), pio_rearr_opt_comm_type,& -! pio_rearr_opt_fcd,& -! pio_rearr_opt_c2i_enable_hs, pio_rearr_opt_c2i_enable_isend,& -! pio_rearr_opt_c2i_max_pend_req,& -! pio_rearr_opt_i2c_enable_hs, pio_rearr_opt_i2c_enable_isend,& -! pio_rearr_opt_i2c_max_pend_req) -! if(ret /= PIO_NOERR) then -! write(shr_log_unit,*) "ERROR: Setting rearranger options failed" -! end if -! end do -! i=1 - else - do i=1,total_comps - if(comp_iamin(i)) then - cname = comp_name(i) - if(len_trim(cname) <= 3) then - nlfilename=trim(shr_string_toLower(cname))//'_modelio.nml' - else - nlfilename=trim(shr_string_toLower(cname(1:3)))//'_modelio.nml_'//cname(4:8) - endif - - call shr_pio_read_component_namelist(nlfilename , comp_comm(i), pio_comp_settings(i)%pio_stride, & - pio_comp_settings(i)%pio_root, pio_comp_settings(i)%pio_numiotasks, & - pio_comp_settings(i)%pio_iotype, pio_comp_settings(i)%pio_rearranger, & - pio_comp_settings(i)%pio_netcdf_ioformat) - call pio_init(comp_comm_iam(i), comp_comm(i), pio_comp_settings(i)%pio_numiotasks, 0, & - pio_comp_settings(i)%pio_stride, & - pio_comp_settings(i)%pio_rearranger, iosystems(i), & - base=pio_comp_settings(i)%pio_root) - ret = pio_set_rearr_opts(iosystems(i), pio_rearr_opt_comm_type,& - pio_rearr_opt_fcd,& - pio_rearr_opt_c2i_enable_hs, pio_rearr_opt_c2i_enable_isend,& - pio_rearr_opt_c2i_max_pend_req,& - pio_rearr_opt_i2c_enable_hs, pio_rearr_opt_i2c_enable_isend,& - pio_rearr_opt_i2c_max_pend_req) - if(ret /= PIO_NOERR) then - write(shr_log_unit,*) "ERROR: Setting rearranger options failed" - end if - end if - end do - end if - do i=1,total_comps - if(comp_iamin(i) .and. (comp_comm_iam(i) == 0)) then - write(shr_log_unit,*) io_compname(i),' : pio_numiotasks = ',pio_comp_settings(i)%pio_numiotasks - write(shr_log_unit,*) io_compname(i),' : pio_stride = ',pio_comp_settings(i)%pio_stride - write(shr_log_unit,*) io_compname(i),' : pio_rearranger = ',pio_comp_settings(i)%pio_rearranger - write(shr_log_unit,*) io_compname(i),' : pio_root = ',pio_comp_settings(i)%pio_root - write(shr_log_unit,*) io_compname(i),' : pio_iotype = ',pio_comp_settings(i)%pio_iotype - end if - enddo - - end subroutine shr_pio_init2 - - - -!=============================================================================== - subroutine shr_pio_finalize( ) - integer :: ierr - integer :: i - do i=1,total_comps - call pio_finalize(iosystems(i), ierr) - end do - - end subroutine shr_pio_finalize - -!=============================================================================== - function shr_pio_getiotype_fromid(compid) result(io_type) - integer, intent(in) :: compid - integer :: io_type - - io_type = pio_comp_settings(shr_pio_getindex(compid))%pio_iotype - - end function shr_pio_getiotype_fromid - - - function shr_pio_getiotype_fromname(component) result(io_type) - ! 'component' must be equal to some element of io_compname(:) - ! (but it is case-insensitive) - character(len=*), intent(in) :: component - integer :: io_type - - io_type = pio_comp_settings(shr_pio_getindex(component))%pio_iotype - - end function shr_pio_getiotype_fromname - - function shr_pio_getrearranger_fromid(compid) result(io_type) - integer, intent(in) :: compid - integer :: io_type - - io_type = pio_comp_settings(shr_pio_getindex(compid))%pio_rearranger - - end function shr_pio_getrearranger_fromid - - - function shr_pio_getrearranger_fromname(component) result(io_type) - ! 'component' must be equal to some element of io_compname(:) - ! (but it is case-insensitive) - character(len=*), intent(in) :: component - integer :: io_type - - io_type = pio_comp_settings(shr_pio_getindex(component))%pio_rearranger - - end function shr_pio_getrearranger_fromname - - function shr_pio_getioformat_fromid(compid) result(io_format) - integer, intent(in) :: compid - integer :: io_format - - io_format = pio_comp_settings(shr_pio_getindex(compid))%pio_netcdf_ioformat - - end function shr_pio_getioformat_fromid - - - function shr_pio_getioformat_fromname(component) result(io_format) - ! 'component' must be equal to some element of io_compname(:) - ! (but it is case-insensitive) - character(len=*), intent(in) :: component - integer :: io_format - - io_format = pio_comp_settings(shr_pio_getindex(component))%pio_netcdf_ioformat - - end function shr_pio_getioformat_fromname - -!=============================================================================== - function shr_pio_getioroot_fromid(compid) result(io_root) - ! 'component' must be equal to some element of io_compname(:) - ! (but it is case-insensitive) - integer, intent(in) :: compid - integer :: io_root - - io_root = pio_comp_settings(shr_pio_getindex(compid))%pio_root - - end function shr_pio_getioroot_fromid - - function shr_pio_getioroot_fromname(component) result(io_root) - ! 'component' must be equal to some element of io_compname(:) - ! (but it is case-insensitive) - character(len=*), intent(in) :: component - integer :: io_root - - io_root = pio_comp_settings(shr_pio_getindex(component))%pio_root - - - end function shr_pio_getioroot_fromname - - -!=============================================================================== - - !! Given a component name, return the index of that component. - !! This is the index into io_compid, io_compname, comp_pio_iotype, etc. - !! If the given component is not found, return -1 - - integer function shr_pio_getindex_fromid(compid) result(index) - implicit none - integer, intent(in) :: compid - integer :: i - - index = -1 - do i=1,total_comps - if(io_compid(i)==compid) then - index = i - exit - end if - end do - - if(index<0) then - call shr_sys_abort('shr_pio_getindex :: compid out of allowed range') - end if - end function shr_pio_getindex_fromid - - - integer function shr_pio_getindex_fromname(component) result(index) - use shr_string_mod, only : shr_string_toupper - - implicit none - - ! 'component' must be equal to some element of io_compname(:) - ! (but it is case-insensitive) - character(len=*), intent(in) :: component - - character(len=len(component)) :: component_ucase - integer :: i - - ! convert component name to upper case in order to match case in io_compname - component_ucase = shr_string_toUpper(component) - - index = -1 ! flag for not found - do i=1,size(io_compname) - if (trim(component_ucase) == trim(io_compname(i))) then - index = i - exit - end if - end do - if(index<0) then - call shr_sys_abort(' shr_pio_getindex:: compid out of allowed range') - end if - end function shr_pio_getindex_fromname - - function shr_pio_getiosys_fromid(compid) result(iosystem) - ! 'component' must be equal to some element of io_compname(:) - ! (but it is case-insensitive) - integer, intent(in) :: compid - type(iosystem_desc_t), pointer :: iosystem - - - iosystem => iosystems(shr_pio_getindex(compid)) - - end function shr_pio_getiosys_fromid - - function shr_pio_getiosys_fromname(component) result(iosystem) - ! 'component' must be equal to some element of io_compname(:) - ! (but it is case-insensitive) - character(len=*), intent(in) :: component - type(iosystem_desc_t), pointer :: iosystem - - iosystem => iosystems(shr_pio_getindex(component)) - - end function shr_pio_getiosys_fromname - -!=============================================================================== - - - - subroutine shr_pio_read_default_namelist(nlfilename, Comm, pio_stride, pio_root, pio_numiotasks, & - pio_iotype, pio_async_interface, pio_rearranger) - - character(len=*), intent(in) :: nlfilename - integer, intent(in) :: Comm - logical, intent(out) :: pio_async_interface - integer, intent(out) :: pio_stride, pio_root, pio_numiotasks, pio_iotype, pio_rearranger - - character(len=shr_kind_cs) :: pio_typename - character(len=shr_kind_cs) :: pio_rearr_comm_type, pio_rearr_comm_fcd - integer :: pio_netcdf_ioformat - integer :: pio_rearr_comm_max_pend_req_comp2io - logical :: pio_rearr_comm_enable_hs_comp2io, pio_rearr_comm_enable_isend_comp2io - integer :: pio_rearr_comm_max_pend_req_io2comp - logical :: pio_rearr_comm_enable_hs_io2comp, pio_rearr_comm_enable_isend_io2comp - character(*),parameter :: subName = '(shr_pio_read_default_namelist) ' - - integer :: iam, ierr, npes, unitn - logical :: iamroot - namelist /pio_default_inparm/ & - pio_async_interface, pio_debug_level, pio_blocksize, & - pio_buffer_size_limit, & - pio_rearr_comm_type, pio_rearr_comm_fcd, & - pio_rearr_comm_max_pend_req_comp2io, pio_rearr_comm_enable_hs_comp2io, & - pio_rearr_comm_enable_isend_comp2io, & - pio_rearr_comm_max_pend_req_io2comp, pio_rearr_comm_enable_hs_io2comp, & - pio_rearr_comm_enable_isend_io2comp - - - call mpi_comm_rank(Comm, iam , ierr) - call shr_mpi_chkerr(ierr,subname//' mpi_comm_rank comm_world') - call mpi_comm_size(Comm, npes, ierr) - call shr_mpi_chkerr(ierr,subname//' mpi_comm_size comm_world') - - if(iam==0) then - iamroot=.true. - else - iamroot=.false. - end if - - !-------------------------------------------------------------------------- - ! read io nml parameters - !-------------------------------------------------------------------------- - pio_stride = -99 ! set based on pio_numiotasks value when initialized < 0 - pio_numiotasks = -99 ! set based on pio_stride value when initialized < 0 - pio_root = -99 - pio_typename = 'nothing' - pio_blocksize= -99 ! io blocking size set internally in pio when < 0 - pio_buffer_size_limit = -99 ! io task memory buffer maximum set internally in pio when < 0 - pio_debug_level = 0 ! no debug info by default - pio_async_interface = .false. ! pio tasks are a subset of component tasks - pio_rearranger = PIO_REARR_SUBSET - pio_netcdf_ioformat = PIO_64BIT_OFFSET - pio_rearr_comm_type = 'p2p' - pio_rearr_comm_fcd = '2denable' - pio_rearr_comm_max_pend_req_comp2io = 0 - pio_rearr_comm_enable_hs_comp2io = .true. - pio_rearr_comm_enable_isend_comp2io = .false. - pio_rearr_comm_max_pend_req_io2comp = 0 - pio_rearr_comm_enable_hs_io2comp = .true. - pio_rearr_comm_enable_isend_io2comp = .false. - - if(iamroot) then - open(newunit=unitn, file=trim(nlfilename), status='old' , iostat=ierr) - if(ierr/=0) then - write(shr_log_unit,*) 'File ',trim(nlfilename),' not found, setting default values.' - else - ierr = 1 - do while( ierr /= 0 ) - read(unitn,nml=pio_default_inparm,iostat=ierr) - if (ierr < 0) then - call shr_sys_abort( subname//':: namelist read returns an'// & - ' end of file or end of record condition '//trim(nlfilename) ) - end if - end do - close(unitn) - call shr_pio_getiotypefromname(pio_typename, pio_iotype, pio_iotype_netcdf) - end if - end if - - call shr_pio_namelist_set(npes, Comm, pio_stride, pio_root, pio_numiotasks, pio_iotype, & - iamroot, pio_rearranger, pio_netcdf_ioformat) - - call shr_mpi_bcast(pio_debug_level, Comm) - call shr_mpi_bcast(pio_blocksize, Comm) - call shr_mpi_bcast(pio_buffer_size_limit, Comm) - call shr_mpi_bcast(pio_async_interface, Comm) - call shr_mpi_bcast(pio_rearranger, Comm) - if (npes == 1) then - pio_rearr_comm_max_pend_req_comp2io = 0 - pio_rearr_comm_max_pend_req_io2comp = 0 - endif - - - call shr_pio_rearr_opts_set(Comm, pio_rearr_comm_type, pio_rearr_comm_fcd, & - pio_rearr_comm_max_pend_req_comp2io, pio_rearr_comm_enable_hs_comp2io, & - pio_rearr_comm_enable_isend_comp2io, & - pio_rearr_comm_max_pend_req_io2comp, pio_rearr_comm_enable_hs_io2comp, & - pio_rearr_comm_enable_isend_io2comp, pio_numiotasks) - - end subroutine shr_pio_read_default_namelist - - subroutine shr_pio_read_component_namelist(nlfilename, Comm, pio_stride, pio_root, & - pio_numiotasks, pio_iotype, pio_rearranger, pio_netcdf_ioformat) - character(len=*), intent(in) :: nlfilename - integer, intent(in) :: Comm - - integer, intent(inout) :: pio_stride, pio_root, pio_numiotasks - integer, intent(inout) :: pio_iotype, pio_rearranger, pio_netcdf_ioformat - character(len=SHR_KIND_CS) :: pio_typename - character(len=SHR_KIND_CS) :: pio_netcdf_format - integer :: unitn - - integer :: iam, ierr, npes - logical :: iamroot - character(*),parameter :: subName = '(shr_pio_read_component_namelist) ' - integer :: pio_default_stride, pio_default_root, pio_default_numiotasks, pio_default_iotype - integer :: pio_default_rearranger, pio_default_netcdf_ioformat - - namelist /pio_inparm/ pio_stride, pio_root, pio_numiotasks, & - pio_typename, pio_rearranger, pio_netcdf_format - - - - call mpi_comm_rank(Comm, iam , ierr) - call shr_mpi_chkerr(ierr,subname//' mpi_comm_rank comm_world') - call mpi_comm_size(Comm, npes, ierr) - call shr_mpi_chkerr(ierr,subname//' mpi_comm_size comm_world') - - if(iam==0) then - iamroot=.true. - else - iamroot=.false. - end if - - pio_default_stride = pio_stride - pio_default_root = pio_root - pio_default_numiotasks = pio_numiotasks - pio_default_iotype = pio_iotype - pio_default_rearranger = pio_rearranger - pio_default_netcdf_ioformat = PIO_64BIT_OFFSET - - !-------------------------------------------------------------------------- - ! read io nml parameters - !-------------------------------------------------------------------------- - pio_stride = -99 ! set based on pio_numiotasks value when initialized < 0 - pio_numiotasks = -99 ! set based on pio_stride value when initialized < 0 - pio_root = -99 - pio_typename = 'nothing' - pio_rearranger = -99 - pio_netcdf_format = '64bit_offset' - - if(iamroot) then - open(newunit=unitn, file=trim(nlfilename), status='old' , iostat=ierr) - if( ierr /= 0) then - write(shr_log_unit,*) 'No ',trim(nlfilename),' found, using defaults for pio settings' - pio_stride = pio_default_stride - pio_root = pio_default_root - pio_numiotasks = pio_default_numiotasks - pio_iotype = pio_default_iotype - pio_rearranger = pio_default_rearranger - pio_netcdf_ioformat = pio_default_netcdf_ioformat - else - ierr = 1 - do while( ierr /= 0 ) - read(unitn,nml=pio_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_pio_getiotypefromname(pio_typename, pio_iotype, pio_default_iotype) - call shr_pio_getioformatfromname(pio_netcdf_format, pio_netcdf_ioformat, pio_default_netcdf_ioformat) - end if - if(pio_stride== -99) then - if (pio_numiotasks > 0) then - pio_stride = npes/pio_numiotasks - else - pio_stride = pio_default_stride - endif - endif - if(pio_root == -99) pio_root = pio_default_root - if(pio_rearranger == -99) pio_rearranger = pio_default_rearranger - if(pio_numiotasks == -99) then - pio_numiotasks = npes/pio_stride - endif - endif - - - - call shr_pio_namelist_set(npes, Comm, pio_stride, pio_root, pio_numiotasks, pio_iotype, & - iamroot, pio_rearranger, pio_netcdf_ioformat) - - - end subroutine shr_pio_read_component_namelist - - subroutine shr_pio_getioformatfromname(pio_netcdf_format, pio_netcdf_ioformat, pio_default_netcdf_ioformat) - use shr_string_mod, only : shr_string_toupper - character(len=*), intent(inout) :: pio_netcdf_format - integer, intent(out) :: pio_netcdf_ioformat - integer, intent(in) :: pio_default_netcdf_ioformat - - pio_netcdf_format = shr_string_toupper(pio_netcdf_format) - if ( pio_netcdf_format .eq. 'CLASSIC' ) then - pio_netcdf_ioformat = 0 - elseif ( pio_netcdf_format .eq. '64BIT_OFFSET' ) then - pio_netcdf_ioformat = PIO_64BIT_OFFSET -#ifdef _PNETCDF - elseif ( pio_netcdf_format .eq. '64BIT_DATA' ) then - pio_netcdf_ioformat = PIO_64BIT_DATA -#endif - else - pio_netcdf_ioformat = pio_default_netcdf_ioformat - endif - - end subroutine shr_pio_getioformatfromname - - - subroutine shr_pio_getiotypefromname(typename, iotype, defaulttype) - use shr_string_mod, only : shr_string_toupper - character(len=*), intent(inout) :: typename - integer, intent(out) :: iotype - integer, intent(in) :: defaulttype - - typename = shr_string_toupper(typename) - if ( typename .eq. 'NETCDF' ) then - iotype = pio_iotype_netcdf - else if ( typename .eq. 'PNETCDF') then - iotype = pio_iotype_pnetcdf - else if ( typename .eq. 'NETCDF4P') then - iotype = pio_iotype_netcdf4p - else if ( typename .eq. 'NETCDF4C') then - iotype = pio_iotype_netcdf4c - else if ( typename .eq. 'NOTHING') then - iotype = defaulttype - else if ( typename .eq. 'DEFAULT') then - iotype = defaulttype - else - write(shr_log_unit,*) 'shr_pio_mod: WARNING Bad io_type argument - using iotype_netcdf' - iotype=pio_iotype_netcdf - end if - - end subroutine shr_pio_getiotypefromname - -!=============================================================================== - subroutine shr_pio_namelist_set(npes,mycomm, pio_stride, pio_root, pio_numiotasks, & - pio_iotype, iamroot, pio_rearranger, pio_netcdf_ioformat) - integer, intent(in) :: npes, mycomm - integer, intent(inout) :: pio_stride, pio_root, pio_numiotasks - integer, intent(inout) :: pio_iotype, pio_rearranger, pio_netcdf_ioformat - logical, intent(in) :: iamroot - character(*),parameter :: subName = '(shr_pio_namelist_set) ' - - call shr_mpi_bcast(pio_iotype , mycomm) - call shr_mpi_bcast(pio_stride , mycomm) - call shr_mpi_bcast(pio_root , mycomm) - call shr_mpi_bcast(pio_numiotasks, mycomm) - call shr_mpi_bcast(pio_rearranger, mycomm) - call shr_mpi_bcast(pio_netcdf_ioformat, mycomm) - - if (pio_root<0) then - pio_root = 1 - endif - pio_root = min(pio_root,npes-1) - -! If you are asking for parallel IO then you should use at least two io pes - if(npes > 1 .and. pio_numiotasks == 1 .and. & - (pio_iotype .eq. PIO_IOTYPE_PNETCDF .or. & - pio_iotype .eq. PIO_IOTYPE_NETCDF4P)) then - pio_numiotasks = 2 - pio_stride = min(pio_stride, npes/2) - endif - - !-------------------------------------------------------------------------- - ! check/set/correct io pio parameters - !-------------------------------------------------------------------------- - if (pio_stride>0.and.pio_numiotasks<0) then - pio_numiotasks = max(1,npes/pio_stride) - else if(pio_numiotasks>0 .and. pio_stride<0) then - pio_stride = max(1,npes/pio_numiotasks) - else if(pio_numiotasks<0 .and. pio_stride<0) then - pio_stride = max(1,npes/4) - pio_numiotasks = max(1,npes/pio_stride) - end if - if(pio_stride == 1) then - pio_root = 0 - endif - if(pio_rearranger .ne. PIO_REARR_SUBSET .and. pio_rearranger .ne. PIO_REARR_BOX) then - write(shr_log_unit,*) 'pio_rearranger value, ',pio_rearranger,& - ', not supported - using PIO_REARR_BOX' - pio_rearranger = PIO_REARR_BOX - - endif - - - if (pio_root + (pio_stride)*(pio_numiotasks-1) >= npes .or. & - pio_stride<=0 .or. pio_numiotasks<=0 .or. pio_root < 0 .or. & - pio_root > npes-1) then - if(npes<100) then - pio_stride = max(1,npes/4) - else if(npes<1000) then - pio_stride = max(1,npes/8) - else - pio_stride = max(1,npes/16) - end if - if(pio_stride>1) then - pio_numiotasks = npes/pio_stride - pio_root = min(1,npes-1) - else - pio_numiotasks = npes - pio_root = 0 - end if - if( iamroot) then - write(shr_log_unit,*) 'pio_stride, iotasks or root out of bounds - resetting to defaults: ',& - pio_stride,pio_numiotasks, pio_root - end if - end if - - end subroutine shr_pio_namelist_set - - ! This subroutine sets the global PIO rearranger options - ! The input args that represent the rearranger options are valid only - ! on the root proc of comm - ! The rearranger options are passed to PIO_Init() in shr_pio_init2() - subroutine shr_pio_rearr_opts_set(comm, pio_rearr_comm_type, pio_rearr_comm_fcd, & - pio_rearr_comm_max_pend_req_comp2io, pio_rearr_comm_enable_hs_comp2io, & - pio_rearr_comm_enable_isend_comp2io, & - pio_rearr_comm_max_pend_req_io2comp, pio_rearr_comm_enable_hs_io2comp, & - pio_rearr_comm_enable_isend_io2comp, & - pio_numiotasks) - integer(SHR_KIND_IN), intent(in) :: comm - character(len=shr_kind_cs), intent(in) :: pio_rearr_comm_type, pio_rearr_comm_fcd - integer, intent(in) :: pio_rearr_comm_max_pend_req_comp2io - logical, intent(in) :: pio_rearr_comm_enable_hs_comp2io - logical, intent(in) :: pio_rearr_comm_enable_isend_comp2io - integer, intent(in) :: pio_rearr_comm_max_pend_req_io2comp - logical, intent(in) :: pio_rearr_comm_enable_hs_io2comp - logical, intent(in) :: pio_rearr_comm_enable_isend_io2comp - integer, intent(in) :: pio_numiotasks - - character(*), parameter :: subname = '(shr_pio_rearr_opts_set) ' - integer, parameter :: NUM_REARR_COMM_OPTS = 8 - integer, parameter :: PIO_REARR_COMM_DEF_MAX_PEND_REQ = 64 - integer(SHR_KIND_IN), dimension(NUM_REARR_COMM_OPTS) :: buf - integer :: rank, ierr - - call mpi_comm_rank(comm, rank, ierr) - call shr_mpi_chkerr(ierr,subname//' mpi_comm_rank comm_world') - - buf = 0 - ! buf(1) = comm_type - ! buf(2) = comm_fcd - ! buf(3) = max_pend_req_comp2io - ! buf(4) = enable_hs_comp2io - ! buf(5) = enable_isend_comp2io - ! buf(6) = max_pend_req_io2comp - ! buf(7) = enable_hs_io2comp - ! buf(8) = enable_isend_io2comp - if(rank == 0) then - ! buf(1) = comm_type - select case(pio_rearr_comm_type) - case ("p2p") - case ("default") - buf(1) = pio_rearr_comm_p2p - case ("coll") - buf(1) = pio_rearr_comm_coll - case default - write(shr_log_unit,*) "Invalid PIO rearranger comm type, ", pio_rearr_comm_type - write(shr_log_unit,*) "Resetting PIO rearrange comm type to p2p" - buf(1) = pio_rearr_comm_p2p - end select - - ! buf(2) = comm_fcd - select case(pio_rearr_comm_fcd) - case ("2denable") - case ("default") - buf(2) = pio_rearr_comm_fc_2d_enable - case ("io2comp") - buf(2) = pio_rearr_comm_fc_1d_io2comp - case ("comp2io") - buf(2) = pio_rearr_comm_fc_1d_comp2io - case ("disable") - buf(2) = pio_rearr_comm_fc_2d_disable - case default - write(shr_log_unit,*) "Invalid PIO rearranger comm flow control direction, ", pio_rearr_comm_fcd - write(shr_log_unit,*) "Resetting PIO rearrange comm flow control direction to 2denable" - buf(2) = pio_rearr_comm_fc_2d_enable - end select - - ! buf(3) = max_pend_req_comp2io - if((pio_rearr_comm_max_pend_req_comp2io < 0) .and. & - (pio_rearr_comm_max_pend_req_comp2io /= PIO_REARR_COMM_UNLIMITED_PEND_REQ)) then - - ! Small multiple of pio_numiotasks has proven to perform - ! well empirically, and we do not want to allow maximum for - ! very large process count runs. Can improve this by - ! communicating between iotasks first, and then non-iotasks - ! to iotasks (TO DO) - write(shr_log_unit, *) "Invalid PIO rearranger comm max pend req (comp2io), ",& - pio_rearr_comm_max_pend_req_comp2io - write(shr_log_unit, *) "Resetting PIO rearranger comm max pend req (comp2io) to ", & - max(PIO_REARR_COMM_DEF_MAX_PEND_REQ, 2 * pio_numiotasks) - buf(3) = max(PIO_REARR_COMM_DEF_MAX_PEND_REQ, 2 * pio_numiotasks) - else - buf(3) = pio_rearr_comm_max_pend_req_comp2io - end if - - ! buf(4) = enable_hs_comp2io - if(pio_rearr_comm_enable_hs_comp2io) then - buf(4) = 1 - else - buf(4) = 0 - end if - - ! buf(5) = enable_isend_comp2io - if(pio_rearr_comm_enable_isend_comp2io) then - buf(5) = 1 - else - buf(5) = 0 - end if - - ! buf(6) = max_pend_req_io2comp - if((pio_rearr_comm_max_pend_req_io2comp < 0) .and. & - (pio_rearr_comm_max_pend_req_io2comp /= PIO_REARR_COMM_UNLIMITED_PEND_REQ)) then - write(shr_log_unit, *) "Invalid PIO rearranger comm max pend req (io2comp), ", pio_rearr_comm_max_pend_req_io2comp - write(shr_log_unit, *) "Resetting PIO rearranger comm max pend req (io2comp) to ", PIO_REARR_COMM_DEF_MAX_PEND_REQ - buf(6) = PIO_REARR_COMM_DEF_MAX_PEND_REQ - else - buf(6) = pio_rearr_comm_max_pend_req_io2comp - end if - - ! buf(7) = enable_hs_io2comp - if(pio_rearr_comm_enable_hs_io2comp) then - buf(7) = 1 - else - buf(7) = 0 - end if - - ! buf(8) = enable_isend_io2comp - if(pio_rearr_comm_enable_isend_io2comp) then - buf(8) = 1 - else - buf(8) = 0 - end if - - ! Log the rearranger options - write(shr_log_unit, *) "PIO rearranger options:" - write(shr_log_unit, *) " comm type =", pio_rearr_comm_type - write(shr_log_unit, *) " comm fcd =", pio_rearr_comm_fcd - write(shr_log_unit, *) " max pend req (comp2io) =", pio_rearr_comm_max_pend_req_comp2io - write(shr_log_unit, *) " enable_hs (comp2io) =", pio_rearr_comm_enable_hs_comp2io - write(shr_log_unit, *) " enable_isend (comp2io) =", pio_rearr_comm_enable_isend_comp2io - write(shr_log_unit, *) " max pend req (io2comp) =", pio_rearr_comm_max_pend_req_io2comp - write(shr_log_unit, *) " enable_hs (io2comp) =", pio_rearr_comm_enable_hs_io2comp - write(shr_log_unit, *) " enable_isend (io2comp) =", pio_rearr_comm_enable_isend_io2comp - end if - - call shr_mpi_bcast(buf, comm) - - ! buf(1) = comm_type - ! buf(2) = comm_fcd - ! buf(3) = max_pend_req_comp2io - ! buf(4) = enable_hs_comp2io - ! buf(5) = enable_isend_comp2io - ! buf(6) = max_pend_req_io2comp - ! buf(7) = enable_hs_io2comp - ! buf(8) = enable_isend_io2comp - pio_rearr_opt_comm_type = buf(1) - pio_rearr_opt_fcd = buf(2) - pio_rearr_opt_c2i_max_pend_req = buf(3) - if(buf(4) == 0) then - pio_rearr_opt_c2i_enable_hs = .false. - else - pio_rearr_opt_c2i_enable_hs = .true. - end if - if(buf(5) == 0) then - pio_rearr_opt_c2i_enable_isend = .false. - else - pio_rearr_opt_c2i_enable_isend = .true. - end if - pio_rearr_opt_i2c_max_pend_req = buf(6) - if(buf(7) == 0) then - pio_rearr_opt_i2c_enable_hs = .false. - else - pio_rearr_opt_i2c_enable_hs = .true. - end if - if(buf(8) == 0) then - pio_rearr_opt_i2c_enable_isend = .false. - else - pio_rearr_opt_i2c_enable_isend = .true. - end if - end subroutine -!=============================================================================== - -end module shr_pio_mod diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 37de93636..305d161eb 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -26,7 +26,9 @@ module dshr_strdata_mod use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian use shr_cal_mod , only : shr_cal_date2ymd, shr_cal_ymd2date use shr_orb_mod , only : shr_orb_decl, shr_orb_cosz, shr_orb_undef_real +#ifdef CESMCOUPLED use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat +#endif use shr_string_mod , only : shr_string_listgetname, shr_string_listisvalid, shr_string_listgetnum use dshr_stream_mod , only : shr_stream_streamtype, shr_stream_getModelFieldList, shr_stream_getStreamFieldList @@ -184,7 +186,7 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn ! local variables type(ESMF_VM) :: vm - integer :: localPet + integer :: i, localPet character(len=*), parameter :: subname='(shr_strdata_init_from_xml)' ! ---------------------------------------------- rc = ESMF_SUCCESS @@ -193,10 +195,12 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn ! Initialize log unit sdat%logunit = logunit +#ifdef CESMCOUPLED ! Initialize sdat pio sdat%pio_subsystem => shr_pio_getiosys(trim(compname)) sdat%io_type = shr_pio_getiotype(trim(compname)) sdat%io_format = shr_pio_getioformat(trim(compname)) +#endif call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -206,7 +210,8 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn ! Initialize sdat streams (read xml file for streams) sdat%masterproc = (localPet == master_task) - call shr_stream_init_from_xml(xmlfilename, sdat%stream, sdat%masterproc, sdat%logunit, trim(compname), rc=rc) + call shr_stream_init_from_xml(xmlfilename, sdat%stream, sdat%masterproc, sdat%logunit, & + sdat%pio_subsystem, sdat%io_type, sdat%io_format, trim(compname), rc=rc) allocate(sdat%pstrm(shr_strdata_get_stream_count(sdat))) @@ -258,10 +263,12 @@ subroutine shr_strdata_init_from_inline(sdat, my_task, logunit, compname, & sdat%logunit = logunit sdat%masterproc = (my_task == master_task) +#ifdef CESMCOUPLED ! Initialize sdat pio sdat%pio_subsystem => shr_pio_getiosys(trim(compname)) sdat%io_type = shr_pio_getiotype(trim(compname)) sdat%io_format = shr_pio_getioformat(trim(compname)) +#endif ! Initialize sdat%pstrm - ASSUME only 1 stream allocate(sdat%pstrm(1)) @@ -273,6 +280,7 @@ subroutine shr_strdata_init_from_inline(sdat, my_task, logunit, compname, & ! Initialize sdat stream - ASSUME only 1 stream call shr_stream_init_from_inline(sdat%stream, & + sdat%pio_subsystem, sdat%io_type, sdat%io_format, & stream_meshfile, stream_lev_dimname, stream_mapalgo, & stream_yearFirst, stream_yearLast, stream_yearAlign, & stream_offset, stream_taxmode, stream_tintalgo, stream_dtlimit, & diff --git a/streams/dshr_stream_mod.F90 b/streams/dshr_stream_mod.F90 index ebf1cbde7..39fa7d1d0 100644 --- a/streams/dshr_stream_mod.F90 +++ b/streams/dshr_stream_mod.F90 @@ -30,7 +30,9 @@ module dshr_stream_mod use pio , only : file_desc_t, pio_inq_varid, iosystem_desc_t, pio_file_is_open use pio , only : pio_nowrite, pio_inquire_dimension, pio_inquire_variable, pio_bcast_error use pio , only : pio_get_att, pio_get_var +#ifdef CESMCOUPLED use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat +#endif implicit none private ! default private @@ -120,8 +122,8 @@ module dshr_stream_mod contains !=============================================================================== - subroutine shr_stream_init_from_xml(xmlfilename, streamdat, isroot_task, logunit, compname, rc) - + subroutine shr_stream_init_from_xml(xmlfilename, streamdat, isroot_task, logunit, & + pio_subsystem, io_type, io_format, compname, rc) use FoX_DOM, only : extractDataContent, destroy, Node, NodeList, parseFile, getElementsByTagname use FoX_DOM, only : getLength, item use ESMF, only : ESMF_VM, ESMF_VMGetCurrent, ESMF_VMBroadCast, ESMF_SUCCESS @@ -154,11 +156,14 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, isroot_task, logunit ! --------------------------------------------------------------------- ! input/output variables + character(len=*), optional , intent(in) :: xmlfilename type(shr_stream_streamType) , intent(inout), pointer :: streamdat(:) - integer , intent(in) :: logunit logical , intent(in) :: isroot_task + integer , intent(in) :: logunit + type(iosystem_desc_t) , intent(in), pointer :: pio_subsystem + integer , intent(in) :: io_type + integer , intent(in) :: io_format character(len=*) , intent(in) :: compname - character(len=*), optional , intent(in) :: xmlfilename integer , intent(out) :: rc ! local variables @@ -345,9 +350,16 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, isroot_task, logunit call ESMF_VMBroadCast(vm, rtmp, 1, 0, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return streamdat(i)%dtlimit = rtmp(1) +#ifdef CESMCOUPLED + ! Initialize stream pio streamdat(i)%pio_subsystem => shr_pio_getiosys(trim(compname)) - streamdat(i)%pio_iotype = shr_pio_getiotype(trim(compname)) - streamdat(i)%pio_ioformat = shr_pio_getioformat(trim(compname)) + streamdat(i)%pio_iotype = shr_pio_getiotype(trim(compname)) + streamdat(i)%pio_ioformat = shr_pio_getioformat(trim(compname)) +#else + streamdat(i)%pio_subsystem => pio_subsystem + streamdat(i)%pio_iotype = io_type + streamdat(i)%pio_ioformat = io_format +#endif call shr_stream_getCalendar(streamdat(i), 1, streamdat(i)%calendar) ! Error check @@ -367,6 +379,7 @@ end subroutine shr_stream_init_from_xml !=============================================================================== subroutine shr_stream_init_from_inline(streamdat, & + pio_subsystem, io_type, io_format, & stream_meshfile, stream_lev_dimname, stream_mapalgo, & stream_yearFirst, stream_yearLast, stream_yearAlign, & stream_offset, stream_taxmode, stream_tintalgo, stream_dtlimit, & @@ -380,6 +393,9 @@ subroutine shr_stream_init_from_inline(streamdat, & ! input/output variables type(shr_stream_streamType) ,pointer, intent(inout) :: streamdat(:) ! data streams (assume 1 below) + type(iosystem_desc_t) ,pointer, intent(in) :: pio_subsystem ! data structure required for pio operations + integer ,intent(in) :: io_type ! data format + integer ,intent(in) :: io_format ! netcdf format character(*) ,intent(in) :: stream_meshFile ! full pathname to stream mesh file character(*) ,intent(in) :: stream_lev_dimname ! name of vertical dimension in stream character(*) ,intent(in) :: stream_mapalgo ! stream mesh -> model mesh mapping type @@ -420,10 +436,16 @@ subroutine shr_stream_init_from_inline(streamdat, & streamdat(1)%offset = stream_offset streamdat(1)%taxMode = trim(stream_taxMode) streamdat(1)%dtlimit = stream_dtlimit - +#ifdef CESMCOUPLED + ! Initialize stream pio streamdat(1)%pio_subsystem => shr_pio_getiosys(trim(compname)) streamdat(1)%pio_iotype = shr_pio_getiotype(trim(compname)) streamdat(1)%pio_ioformat = shr_pio_getioformat(trim(compname)) +#else + streamdat(1)%pio_subsystem => pio_subsystem + streamdat(1)%pio_iotype = io_type + streamdat(1)%pio_ioformat = io_format +#endif ! initialize stream filenames if (allocated(streamdat(1)%file)) then From c4c30bd5dd3f8ae870f77fb0dbf1142a05baafb6 Mon Sep 17 00:00:00 2001 From: BinLi-NOAA Date: Thu, 25 Mar 2021 19:34:59 -0400 Subject: [PATCH 06/10] Add Fortran module for GEFS data source in CDEPS (#13) --- datm/CMakeLists.txt | 1 + datm/atm_comp_nuopc.F90 | 22 +++ datm/datm_datamode_cfsr_mod.F90 | 45 ------ datm/datm_datamode_gefs_mod.F90 | 258 ++++++++++++++++++++++++++++++++ 4 files changed, 281 insertions(+), 45 deletions(-) create mode 100644 datm/datm_datamode_gefs_mod.F90 diff --git a/datm/CMakeLists.txt b/datm/CMakeLists.txt index fb3f85736..3f78d8026 100644 --- a/datm/CMakeLists.txt +++ b/datm/CMakeLists.txt @@ -4,6 +4,7 @@ set(SRCFILES atm_comp_nuopc.F90 datm_datamode_cplhist_mod.F90 datm_datamode_core2_mod.F90 datm_datamode_jra_mod.F90 + datm_datamode_gefs_mod.F90 datm_datamode_cfsr_mod.F90 datm_datamode_era5_mod.F90) diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index f1ade377b..c53b14649 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -65,6 +65,12 @@ module atm_comp_nuopc use datm_datamode_era5_mod , only : datm_datamode_era5_restart_write use datm_datamode_era5_mod , only : datm_datamode_era5_restart_read + use datm_datamode_gefs_mod , only : datm_datamode_gefs_advertise + use datm_datamode_gefs_mod , only : datm_datamode_gefs_init_pointers + use datm_datamode_gefs_mod , only : datm_datamode_gefs_advance + use datm_datamode_gefs_mod , only : datm_datamode_gefs_restart_write + use datm_datamode_gefs_mod , only : datm_datamode_gefs_restart_read + use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_advertise use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_init_pointers use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_advance @@ -309,6 +315,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) trim(datamode) == 'CORE_IAF_JRA' .or. & trim(datamode) == 'CLMNCEP' .or. & trim(datamode) == 'CPLHIST' .or. & + trim(datamode) == 'GEFS' .or. & trim(datamode) == 'CFSR' .or. & trim(datamode) == 'ERA5') then else @@ -335,6 +342,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) case ('ERA5') call datm_datamode_era5_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case ('GEFS') + call datm_datamode_gefs_advertise(exportState, fldsExport, flds_scalar_name, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return case ('CFSR') call datm_datamode_cfsr_advertise(exportState, fldsExport, flds_scalar_name, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -577,6 +587,9 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe case('ERA5') call datm_datamode_era5_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('GEFS') + call datm_datamode_gefs_init_pointers(exportState, sdat, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CFSR') call datm_datamode_cfsr_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -595,6 +608,8 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe call datm_datamode_cplhist_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) case('ERA5') call datm_datamode_era5_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) + case('GEFS') + call datm_datamode_gefs_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) case('CFSR') call datm_datamode_cfsr_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat) end select @@ -644,6 +659,9 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe call datm_datamode_era5_advance(exportstate, masterproc, logunit, mpicom, target_ymd, & target_tod, sdat%model_calendar, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('GEFS') + call datm_datamode_gefs_advance(exportstate, masterproc, logunit, mpicom, target_ymd, & + target_tod, sdat%model_calendar, rc) case('CFSR') call datm_datamode_cfsr_advance(exportstate, masterproc, logunit, mpicom, target_ymd, & target_tod, sdat%model_calendar, rc) @@ -673,6 +691,10 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe call datm_datamode_era5_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) if (ChkErr(rc,__LINE__,u_FILE_u)) return + case('GEFS') + call datm_datamode_gefs_restart_write(case_name, inst_suffix, target_ymd, target_tod, & + logunit, my_task, sdat) + if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CFSR') call datm_datamode_cfsr_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) diff --git a/datm/datm_datamode_cfsr_mod.F90 b/datm/datm_datamode_cfsr_mod.F90 index d76235325..21e591b99 100644 --- a/datm/datm_datamode_cfsr_mod.F90 +++ b/datm/datm_datamode_cfsr_mod.F90 @@ -212,57 +212,12 @@ subroutine datm_datamode_cfsr_advance(exportstate, masterproc, logunit, mpicom, !--- bottom layer height --- ! Sa_z(n) = 10.0_r8 - !--- calculate wind speed --- -! if (associated(Sa_wspd)) then -! Sa_wspd(n) = sqrt(Sa_u(n)*Sa_u(n)+Sa_v(n)*Sa_v(n)) -! end if - !--- temperature --- if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz ! Limit very cold forcing to 180K Sa_tbot(n) = max(180._r8, Sa_tbot(n)) -! Sa_ptem(n) = Sa_tbot(n) end do - !---------------------------------------------------------- - ! unit conversions (temporal resolution is hourly) - !---------------------------------------------------------- - - ! convert J/m^2 to W/m^2 - !Faxa_lwdn(:) = Faxa_lwdn(:)/3600.0_r8 -! Faxa_lwdn(:) = Faxa_lwdn(:)/21600.0_r8 -! if (associated(Faxa_lwnet)) then -! Faxa_lwnet(:) = Faxa_lwnet(:)/3600.0_r8 -! end if -! Faxa_swdn(:) = Faxa_swdn(:)/3600.0_r8 -! Faxa_swdn(:) = Faxa_swdn(:)/21600.0_r8 - !Faxa_swvdr(:) = Faxa_swvdr(:)/3600.0_r8 - !Faxa_swndr(:) = Faxa_swndr(:)/3600.0_r8 - !Faxa_swvdf(:) = Faxa_swvdf(:)/3600.0_r8 - !Faxa_swndf(:) = Faxa_swndf(:)/3600.0_r8 -! Faxa_swvdr(:) = Faxa_swvdr(:)/21600.0_r8 -! Faxa_swndr(:) = Faxa_swndr(:)/21600.0_r8 -! Faxa_swvdf(:) = Faxa_swvdf(:)/21600.0_r8 -! Faxa_swndf(:) = Faxa_swndf(:)/21600.0_r8 -! Faxa_swnet(:) = Faxa_swnet(:)/3600.0_r8 -! Faxa_sen(:) = Faxa_sen(:)/3600.0_r8 -! Faxa_lat(:) = Faxa_lat(:)/3600.0_r8 - - ! convert m to kg/m^2/s - !Faxa_rain(:) = Faxa_rain(:)/3600.0_r8*rhofw -! Faxa_rain(:) = Faxa_rain(:)/21600.0_r8*rhofw -! Faxa_rainc(:) = Faxa_rainc(:)/3600.0_r8*rhofw -! Faxa_rainl(:) = Faxa_rainl(:)/3600.0_r8*rhofw -! Faxa_snowc(:) = Faxa_snowc(:)/3600.0_r8*rhofw - !Faxa_snow(:) = Faxa_snow(:)/3600.0_r8*rhofw -! Faxa_snow(:) = Faxa_snow(:)/21600.0_r8*rhofw - - ! convert N/m^2 s to N/m^2 -! Faxa_taux(:) = Faxa_taux(:)/3600.0_r8 -! Faxa_tauy(:) = Faxa_tauy(:)/3600.0_r8 -! Faxa_taux(:) = Faxa_taux(:)/21600.0_r8 -! Faxa_tauy(:) = Faxa_tauy(:)/21600.0_r8 - end subroutine datm_datamode_cfsr_advance !=============================================================================== diff --git a/datm/datm_datamode_gefs_mod.F90 b/datm/datm_datamode_gefs_mod.F90 new file mode 100644 index 000000000..c31146f9f --- /dev/null +++ b/datm/datm_datamode_gefs_mod.F90 @@ -0,0 +1,258 @@ +module datm_datamode_gefs_mod + + use ESMF + use NUOPC , only : NUOPC_Advertise + use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs + use shr_sys_mod , only : shr_sys_abort + use shr_precip_mod , only : shr_precip_partition_rain_snow_ramp + use shr_mpi_mod , only : shr_mpi_max + use shr_const_mod , only : shr_const_tkfrz, shr_const_rhofw, shr_const_rdair + use dshr_methods_mod , only : dshr_state_getfldptr, chkerr + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_get_stream_pointer + use dshr_mod , only : dshr_restart_read, dshr_restart_write + use dshr_strdata_mod , only : shr_strdata_type + use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add + + implicit none + private ! except + + public :: datm_datamode_gefs_advertise + public :: datm_datamode_gefs_init_pointers + public :: datm_datamode_gefs_advance + public :: datm_datamode_gefs_restart_write + public :: datm_datamode_gefs_restart_read +! private :: datm_eSat ! determine saturation vapor pressure + + ! export state data + real(r8), pointer :: Sa_z(:) => null() + real(r8), pointer :: Sa_u(:) => null() + real(r8), pointer :: Sa_v(:) => null() + real(r8), pointer :: Sa_tbot(:) => null() + real(r8), pointer :: Sa_shum(:) => null() + real(r8), pointer :: Sa_pbot(:) => null() + real(r8), pointer :: Sa_u10m(:) => null() + real(r8), pointer :: Sa_v10m(:) => null() + real(r8), pointer :: Sa_t2m(:) => null() + real(r8), pointer :: Sa_q2m(:) => null() + real(r8), pointer :: Sa_pslv(:) => null() + real(r8), pointer :: Faxa_lwdn(:) => null() + real(r8), pointer :: Faxa_rain(:) => null() + real(r8), pointer :: Faxa_snow(:) => null() + real(r8), pointer :: Faxa_swndr(:) => null() + real(r8), pointer :: Faxa_swndf(:) => null() + real(r8), pointer :: Faxa_swvdr(:) => null() + real(r8), pointer :: Faxa_swvdf(:) => null() + + ! stream data + real(r8), pointer :: strm_mask(:) => null() + + real(r8) :: tbotmax ! units detector + real(r8) :: maskmax ! units detector + + real(r8) , parameter :: tKFrz = SHR_CONST_TKFRZ + real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg + real(r8) , parameter :: rhofw = SHR_CONST_RHOFW ! density of fresh water ~ kg/m^3 + + character(*), parameter :: nullstr = 'undefined' + character(*), parameter :: rpfile = 'rpointer.atm' + character(*), parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine datm_datamode_gefs_advertise(exportState, fldsexport, & + flds_scalar_name, rc) + + ! input/output variables + type(esmf_State) , intent(inout) :: exportState + type(fldlist_type) , pointer :: fldsexport + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(out) :: rc + + ! local variables + type(fldlist_type), pointer :: fldList + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + call dshr_fldList_add(fldsExport, trim(flds_scalar_name)) + call dshr_fldList_add(fldsExport, 'Sa_z' ) + call dshr_fldList_add(fldsExport, 'Sa_u' ) + call dshr_fldList_add(fldsExport, 'Sa_v' ) + call dshr_fldList_add(fldsExport, 'Sa_tbot' ) + call dshr_fldList_add(fldsExport, 'Sa_pbot' ) + call dshr_fldList_add(fldsExport, 'Sa_shum' ) + call dshr_fldList_add(fldsExport, 'Sa_u10m' ) + call dshr_fldList_add(fldsExport, 'Sa_v10m' ) + call dshr_fldList_add(fldsExport, 'Sa_t2m' ) + call dshr_fldList_add(fldsExport, 'Sa_q2m' ) + call dshr_fldList_add(fldsExport, 'Sa_pslv' ) + call dshr_fldList_add(fldsExport, 'Faxa_rain' ) + call dshr_fldList_add(fldsExport, 'Faxa_snow' ) + call dshr_fldList_add(fldsExport, 'Faxa_swndr' ) + call dshr_fldList_add(fldsExport, 'Faxa_swvdr' ) + call dshr_fldList_add(fldsExport, 'Faxa_swndf' ) + call dshr_fldList_add(fldsExport, 'Faxa_swvdf' ) + call dshr_fldList_add(fldsExport, 'Faxa_lwdn' ) + + fldlist => fldsExport ! the head of the linked list + do while (associated(fldlist)) + call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite('(datm_comp_advertise): Fr_atm '//trim(fldList%stdname), ESMF_LOGMSG_INFO) + fldList => fldList%next + enddo + + end subroutine datm_datamode_gefs_advertise + + !=============================================================================== + subroutine datm_datamode_gefs_init_pointers(exportState, sdat, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: exportState + type(shr_strdata_type) , intent(in) :: sdat + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(datm_init_pointers): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! initialize pointers for module level stream arrays + call shr_strdata_get_stream_pointer( sdat, 'Sa_mask' , strm_mask , rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! get export state pointers + call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_v' , fldptr1=Sa_v , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_tbot' , fldptr1=Sa_tbot , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_pbot' , fldptr1=Sa_pbot , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_shum' , fldptr1=Sa_shum , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_u10m' , fldptr1=Sa_u10m , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_v10m' , fldptr1=Sa_v10m , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_t2m' , fldptr1=Sa_t2m , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_q2m' , fldptr1=Sa_q2m , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Sa_pslv' , fldptr1=Sa_pslv , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_rain' , fldptr1=Faxa_rain , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_snow' , fldptr1=Faxa_snow, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swvdr' , fldptr1=Faxa_swvdr , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swvdf' , fldptr1=Faxa_swvdf , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swndr' , fldptr1=Faxa_swndr , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_swndf' , fldptr1=Faxa_swndf , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call dshr_state_getfldptr(exportState, 'Faxa_lwdn' , fldptr1=Faxa_lwdn , rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end subroutine datm_datamode_gefs_init_pointers + + !=============================================================================== + subroutine datm_datamode_gefs_advance(exportstate, masterproc, logunit, mpicom, target_ymd, target_tod, model_calendar, rc) + + ! input/output variables + type(ESMF_State) , intent(inout) :: exportState + logical , intent(in) :: masterproc + integer , intent(in) :: logunit + integer , intent(in) :: mpicom + integer , intent(in) :: target_ymd + integer , intent(in) :: target_tod + character(len=*) , intent(in) :: model_calendar + integer , intent(out) :: rc + + ! local variables + logical :: first_time = .true. + integer :: n ! indices + integer :: lsize ! size of attr vect + real(r8) :: rtmp + real(r8) :: tbot, pbot +! real(r8) :: vp + real(r8) :: e, qsat + character(len=*), parameter :: subname='(datm_datamode_gefs_advance): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lsize = size(strm_mask) + + if (first_time) then + ! determine tbotmax (see below for use) + rtmp = maxval(Sa_tbot(:)) + call shr_mpi_max(rtmp, tbotmax, mpicom, 'datm_tbot', all=.true.) + if (masterproc) write(logunit,*) trim(subname),' tbotmax = ',tbotmax + + ! determine maskmax (see below for use) + rtmp = maxval(strm_mask(:)) + call shr_mpi_max(rtmp, maskmax, mpicom, 'datm_mask', all=.true.) + if (masterproc) write(logunit,*) trim(subname),' maskmax = ',maskmax + + ! reset first_time + first_time = .false. + end if + + do n = 1, lsize + !--- bottom layer height --- +! Sa_z(n) = 10.0_r8 + + !--- temperature --- + if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz + ! Limit very cold forcing to 180K + Sa_tbot(n) = max(180._r8, Sa_tbot(n)) + end do + + end subroutine datm_datamode_gefs_advance + + !=============================================================================== + subroutine datm_datamode_gefs_restart_write(case_name, inst_suffix, ymd, tod, & + logunit, my_task, sdat) + + ! input/output variables + character(len=*) , intent(in) :: case_name + character(len=*) , intent(in) :: inst_suffix + integer , intent(in) :: ymd ! model date + integer , intent(in) :: tod ! model sec into model date + integer , intent(in) :: logunit + integer , intent(in) :: my_task + type(shr_strdata_type) , intent(inout) :: sdat + !------------------------------------------------------------------------------- + + call dshr_restart_write(rpfile, case_name, 'datm', inst_suffix, ymd, tod, & + logunit, my_task, sdat) + + end subroutine datm_datamode_gefs_restart_write + + !=============================================================================== + subroutine datm_datamode_gefs_restart_read(rest_filem, inst_suffix, logunit, my_task, mpicom, sdat) + + ! input/output arguments + character(len=*) , intent(inout) :: rest_filem + character(len=*) , intent(in) :: inst_suffix + integer , intent(in) :: logunit + integer , intent(in) :: my_task + integer , intent(in) :: mpicom + type(shr_strdata_type) , intent(inout) :: sdat + !------------------------------------------------------------------------------- + + call dshr_restart_read(rest_filem, rpfile, inst_suffix, nullstr, logunit, my_task, mpicom, sdat) + + end subroutine datm_datamode_gefs_restart_read + +end module datm_datamode_gefs_mod From 69a3a6156a574d9686be1953243872d564c17acb Mon Sep 17 00:00:00 2001 From: Jun Wang <37633869+junwang-noaa@users.noreply.github.com> Date: Wed, 14 Apr 2021 16:29:37 -0400 Subject: [PATCH 07/10] remove FoX depdencies (#17) * remove FoX depdencies * remove fox submodule * update streamfilename Co-authored-by: Jun Wang --- .gitmodules | 3 - datm/atm_comp_nuopc.F90 | 11 +- dice/ice_comp_nuopc.F90 | 11 +- dlnd/lnd_comp_nuopc.F90 | 11 +- docn/ocn_comp_nuopc.F90 | 11 +- drof/rof_comp_nuopc.F90 | 11 +- dshr/dshr_mod.F90 | 2 +- dwav/wav_comp_nuopc.F90 | 11 +- fox | 1 - streams/dshr_strdata_mod.F90 | 22 ++-- streams/dshr_stream_mod.F90 | 205 ++++++++++++++++++++++++++++++++++- 11 files changed, 259 insertions(+), 40 deletions(-) delete mode 160000 fox diff --git a/.gitmodules b/.gitmodules index eff7950f6..e69de29bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "fox"] - path = fox - url = https://github.com/ESMCI/fox.git diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index c53b14649..0e896454f 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -26,7 +26,7 @@ module atm_comp_nuopc use shr_cal_mod , only : shr_cal_ymd2date, shr_cal_ymd2julian, shr_cal_date2julian use shr_mpi_mod , only : shr_mpi_bcast use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck - use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_xml, shr_strdata_advance + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_config, shr_strdata_advance use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_setOrbs use dshr_mod , only : dshr_model_initphase, dshr_init use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance @@ -111,7 +111,7 @@ module atm_comp_nuopc ! datm_in namelist input character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from - character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from + character(CL) :: streamfilename = nullstr ! filename to obtain stream info from character(CL) :: dataMode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from @@ -392,8 +392,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type - xmlfilename = 'datm.streams'//trim(inst_suffix)//'.xml' - call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'ATM', logunit, rc=rc) + streamfilename = 'datm.streams'//trim(inst_suffix) +#ifndef DISABLE_FoX + streamfilename = trim(streamfilename)//'.xml' +#endif + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'ATM', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('datm_strdata_init') diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index 4fd0fa5f9..2ebe8458d 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -27,7 +27,7 @@ module ice_comp_nuopc use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_mesh_init use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck - use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_xml, shr_strdata_advance + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_config, shr_strdata_advance use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize @@ -68,7 +68,7 @@ module ice_comp_nuopc character(*) , parameter :: nullstr = 'null' ! dice_in namelist input - character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from + character(CL) :: streamfilename = nullstr ! filename to obtain stream info from character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from character(CL) :: dataMode ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile @@ -307,8 +307,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type - xmlfilename = 'dice.streams'//trim(inst_suffix)//'.xml' - call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'ICE', logunit, rc=rc) + streamfilename = 'dice.streams'//trim(inst_suffix) +#ifndef DISABLE_FoX + streamfilename = trim(streamfilename)//'.xml' +#endif + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'ICE', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dice_strdata_init') diff --git a/dlnd/lnd_comp_nuopc.F90 b/dlnd/lnd_comp_nuopc.F90 index 5e0cc6c92..f863e2c84 100644 --- a/dlnd/lnd_comp_nuopc.F90 +++ b/dlnd/lnd_comp_nuopc.F90 @@ -24,7 +24,7 @@ module lnd_comp_nuopc use shr_mpi_mod , only : shr_mpi_bcast use dshr_methods_mod , only : dshr_state_getfldptr, dshr_state_diagnose, chkerr, memcheck use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_get_stream_domain - use dshr_strdata_mod , only : shr_strdata_init_from_xml + use dshr_strdata_mod , only : shr_strdata_init_from_config use dshr_mod , only : dshr_model_initphase, dshr_init use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init @@ -70,7 +70,7 @@ module lnd_comp_nuopc character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from - character(CL) :: xmlfilename ! filename to obtain stream info from + character(CL) :: streamfilename ! filename to obtain stream info from character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from logical :: force_prognostic_true = .false. ! if true set prognostic true character(CL) :: restfilm = nullstr ! model restart file namelist @@ -287,8 +287,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) model_mask, model_frac, restart_read, rc=rc) ! Initialize stream data type - xmlfilename = 'dlnd.streams'//trim(inst_suffix)//'.xml' - call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'LND', logunit, rc=rc) + streamfilename = 'dlnd.streams'//trim(inst_suffix) +#ifndef DISABLE_FoX + streamfilename = trim(streamfilename)'.xml' +#endif + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'LND', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dlnd_strdata_init') diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index b6c3b15e7..86ad49a7e 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -23,7 +23,7 @@ module ocn_comp_nuopc use shr_cal_mod , only : shr_cal_ymd2date use shr_mpi_mod , only : shr_mpi_bcast use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck - use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_xml + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_config use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_mesh_init use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy @@ -81,7 +81,7 @@ module ocn_comp_nuopc character(*) , parameter :: nullstr = 'null' ! docn_in namelist input - character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from + character(CL) :: streamfilename = nullstr ! filename to obtain stream info from character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from character(CL) :: datamode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile @@ -329,8 +329,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize stream data type if not aqua planet if (.not. aquaplanet) then - xmlfilename = trim(modelname)//'.streams'//trim(inst_suffix)//'.xml' - call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'OCN', logunit, rc=rc) + streamfilename = trim(modelname)//'.streams'//trim(inst_suffix) +#ifndef DISABLE_FoX + streamfilename = trim(streamfilename)//'.xml' +#endif + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'OCN', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if call ESMF_TraceRegionExit('docn_strdata_init') diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index 27c0139d1..a9937f1a6 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -25,7 +25,7 @@ module rof_comp_nuopc use shr_mpi_mod , only : shr_mpi_bcast use dshr_methods_mod , only : dshr_state_getfldptr, dshr_state_diagnose, chkerr, memcheck use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_get_stream_domain - use dshr_strdata_mod , only : shr_strdata_init_from_xml + use dshr_strdata_mod , only : shr_strdata_init_from_config use dshr_mod , only : dshr_model_initphase, dshr_init use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init @@ -61,7 +61,7 @@ module rof_comp_nuopc character(CL) :: case_name ! case name character(*) , parameter :: nullstr = 'null' ! drof_in namelist input - character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from + character(CL) :: streamfilename = nullstr ! filename to obtain stream info from character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from character(CL) :: dataMode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile @@ -285,8 +285,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type - xmlfilename = 'drof.streams'//trim(inst_suffix)//'.xml' - call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'ROF', logunit, rc=rc) + streamfilename = 'drof.streams'//trim(inst_suffix) +#ifndef DISABLE_FOX + streamfilename = trim(streamfilename)//'.xml' +#endif + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'ROF', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('drof_strdata_init') diff --git a/dshr/dshr_mod.F90 b/dshr/dshr_mod.F90 index 0ad235a1e..72969d487 100644 --- a/dshr/dshr_mod.F90 +++ b/dshr/dshr_mod.F90 @@ -41,7 +41,7 @@ module dshr_mod #ifdef CESMCOUPLED use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat #endif - use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_xml, SHR_STRDATA_GET_STREAM_COUNT + use dshr_strdata_mod , only : shr_strdata_type, SHR_STRDATA_GET_STREAM_COUNT use dshr_methods_mod , only : chkerr use pio diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index 70f360d45..2159a8c16 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -24,7 +24,7 @@ module wav_comp_nuopc use shr_mpi_mod , only : shr_mpi_bcast use dshr_methods_mod , only : dshr_state_getfldptr, chkerr, memcheck, dshr_state_diagnose use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance - use dshr_strdata_mod , only : shr_strdata_init_from_xml + use dshr_strdata_mod , only : shr_strdata_init_from_config use dshr_mod , only : dshr_model_initphase, dshr_init use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init @@ -64,7 +64,7 @@ module wav_comp_nuopc character(*) , parameter :: nullstr = 'null' ! dwav_in namelist input - character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from + character(CL) :: streamfilename = nullstr ! filename to obtain stream info from character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from character(CL) :: dataMode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile @@ -273,8 +273,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type if not aqua planet - xmlfilename = 'dwav.streams'//trim(inst_suffix)//'.xml' - call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'WAV', logunit, rc=rc) + streamfilename = 'dwav.streams'//trim(inst_suffix) +#ifndef DISABLE_FoX + streamfilename = trim(streamfilename)//'.xml' +#endif + call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'WAV', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TraceRegionExit('dwav_strdata_init') diff --git a/fox b/fox deleted file mode 160000 index 7b9488446..000000000 --- a/fox +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7b9488446b193192dd3f0378541e71099cb4e8a8 diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 305d161eb..653524ea5 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -34,7 +34,10 @@ module dshr_strdata_mod use dshr_stream_mod , only : shr_stream_streamtype, shr_stream_getModelFieldList, shr_stream_getStreamFieldList use dshr_stream_mod , only : shr_stream_taxis_cycle, shr_stream_taxis_extend, shr_stream_findBounds use dshr_stream_mod , only : shr_stream_getCurrFile, shr_stream_setCurrFile, shr_stream_getMeshFilename - use dshr_stream_mod , only : shr_stream_init_from_xml, shr_stream_init_from_inline + use dshr_stream_mod , only : shr_stream_init_from_inline, shr_stream_init_from_esmfconfig +#ifndef DISABLE_FoX + use dshr_stream_mod , only : shr_stream_init_from_xml +#endif use dshr_stream_mod , only : shr_stream_getnextfilename, shr_stream_getprevfilename, shr_stream_getData use dshr_tinterp_mod , only : shr_tInterp_getCosz, shr_tInterp_getAvgCosz, shr_tInterp_getFactors use dshr_methods_mod , only : dshr_fldbun_getfldptr, dshr_fldbun_getfieldN, dshr_fldbun_fldchk, chkerr @@ -53,7 +56,7 @@ module dshr_strdata_mod private public :: shr_strdata_type - public :: shr_strdata_init_from_xml + public :: shr_strdata_init_from_config public :: shr_strdata_init_from_inline public :: shr_strdata_setOrbs public :: shr_strdata_advance @@ -173,11 +176,11 @@ type(ESMF_FieldBundle) function shr_strdata_get_stream_fieldbundle(sdat, ns, nam end function shr_strdata_get_stream_fieldbundle !=============================================================================== - subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compname, logunit, rc) + subroutine shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, compname, logunit, rc) ! input/output variables type(shr_strdata_type) , intent(inout) :: sdat - character(len=*) , intent(in) :: xmlfilename + character(len=*) , intent(in) :: streamfilename type(ESMF_Mesh) , intent(in) :: model_mesh type(ESMF_Clock) , intent(in) :: clock character(len=*) , intent(in) :: compname @@ -187,7 +190,7 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn ! local variables type(ESMF_VM) :: vm integer :: i, localPet - character(len=*), parameter :: subname='(shr_strdata_init_from_xml)' + character(len=*), parameter :: subname='(shr_strdata_init_from_config)' ! ---------------------------------------------- rc = ESMF_SUCCESS call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) @@ -210,8 +213,13 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn ! Initialize sdat streams (read xml file for streams) sdat%masterproc = (localPet == master_task) - call shr_stream_init_from_xml(xmlfilename, sdat%stream, sdat%masterproc, sdat%logunit, & +#ifdef DISABLE_FoX + call shr_stream_init_from_esmfconfig(streamfilename, sdat%stream, sdat%logunit, & + sdat%pio_subsystem, sdat%io_type, sdat%io_format, rc=rc) +#else + call shr_stream_init_from_xml(streamfilename, sdat%stream, sdat%masterproc, sdat%logunit, & sdat%pio_subsystem, sdat%io_type, sdat%io_format, trim(compname), rc=rc) +#endif allocate(sdat%pstrm(shr_strdata_get_stream_count(sdat))) @@ -224,7 +232,7 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn call shr_strdata_init(sdat, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end subroutine shr_strdata_init_from_xml + end subroutine shr_strdata_init_from_config !=============================================================================== subroutine shr_strdata_init_from_inline(sdat, my_task, logunit, compname, & diff --git a/streams/dshr_stream_mod.F90 b/streams/dshr_stream_mod.F90 index 39fa7d1d0..dd0410b47 100644 --- a/streams/dshr_stream_mod.F90 +++ b/streams/dshr_stream_mod.F90 @@ -41,7 +41,10 @@ module dshr_stream_mod public :: shr_stream_streamType ! stream data type with private components ! !PUBLIC MEMBER FUNCTIONS: + public :: shr_stream_init_from_esmfconfig +#ifndef DISABLE_FoX public :: shr_stream_init_from_xml +#endif public :: shr_stream_init_from_inline ! initial stream type public :: shr_stream_findBounds ! return lower/upper bounding date info public :: shr_stream_getMeshFileName ! return stream filename @@ -122,7 +125,8 @@ module dshr_stream_mod contains !=============================================================================== - subroutine shr_stream_init_from_xml(xmlfilename, streamdat, isroot_task, logunit, & +#ifndef DISABLE_FoX + subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logunit, & pio_subsystem, io_type, io_format, compname, rc) use FoX_DOM, only : extractDataContent, destroy, Node, NodeList, parseFile, getElementsByTagname use FoX_DOM, only : getLength, item @@ -156,7 +160,7 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, isroot_task, logunit ! --------------------------------------------------------------------- ! input/output variables - character(len=*), optional , intent(in) :: xmlfilename + character(len=*), optional , intent(in) :: streamfilename type(shr_stream_streamType) , intent(inout), pointer :: streamdat(:) logical , intent(in) :: isroot_task integer , intent(in) :: logunit @@ -184,9 +188,9 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, isroot_task, logunit if (isroot_task) then - Sdoc => parseFile(xmlfilename, iostat=status) + Sdoc => parseFile(streamfilename, iostat=status) if (status /= 0) then - call shr_sys_abort("Could not parse file "//trim(xmlfilename)) + call shr_sys_abort("Could not parse file "//trim(streamfilename)) endif streamlist => getElementsByTagname(Sdoc, "stream_info") nstrms = getLength(streamlist) @@ -376,6 +380,8 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, isroot_task, logunit end subroutine shr_stream_init_from_xml +#endif + !=============================================================================== subroutine shr_stream_init_from_inline(streamdat, & @@ -479,6 +485,197 @@ subroutine shr_stream_init_from_inline(streamdat, & end subroutine shr_stream_init_from_inline + !=============================================================================== + subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit, & + pio_subsystem, io_type, io_format, rc) + + use esmf , only : ESMF_VM, ESMF_VMGetCurrent, ESMF_VMBroadCast + use esmf , only : ESMF_SUCCESS, ESMF_ConfigCreate, ESMF_ConfigLoadFile + use esmf , only : ESMF_ConfigGetLen, ESMF_ConfigGetAttribute + use esmf , only : ESMF_Config, ESMF_MAXSTR + + !!--------------------------------------------------------------------- + !! The configuration file is a text file that can have following entries + !! file_id: "stream" + !! file_version: 1.0 + !! stream_info: 1 + !! taxmode: + !! tInterpAlgo: + !! readMode: + !! mapalgo: + !! dtlimit: + !! yearFirst: + !! yearLast: + !! yearAlign: + !! stream_vectors: + !! stream_mesh_file: + !! stream_lev_dimname: + !! stream_data_files: + !! stream_data_variables: + !! stream_offset: + !!--------------------------------------------------------------------- + + ! input/output variables + character(len=*), optional , intent(in) :: streamfilename + type(shr_stream_streamType) , intent(inout), pointer :: streamdat(:) + integer , intent(in) :: logunit + type(iosystem_desc_t) , intent(in), pointer :: pio_subsystem + integer , intent(in) :: io_type + integer , intent(in) :: io_format + integer , intent(out) :: rc + + ! local variables + type(ESMF_VM) :: vm + type(ESMF_Config) :: cf + integer :: i, n, nstrms + character(2) :: mystrm + character(*),parameter :: subName = '(shr_stream_init_from_esmfconfig)' + character(len=ESMF_MAXSTR), allocatable :: strm_tmpstrings(:) + character(*) , parameter :: u_FILE_u = __FILE__ + + ! --------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + nstrms = 0 + + ! allocate streamdat instance on all tasks + call ESMF_VMGetCurrent(vm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! set ESMF config + cf = ESMF_ConfigCreate(rc=RC) + call ESMF_ConfigLoadFile(config=CF ,filename=trim(streamfilename), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + + ! get number of streams + nstrms = ESMF_ConfigGetLen(config=CF, label='stream_info:', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! allocate an array of shr_stream_streamtype objects on just isroot_task + if( nstrms > 0 ) then + allocate(streamdat(nstrms)) + else + call shr_sys_abort("no stream_info in config file "//trim(streamfilename)) + endif + + ! fill in non-default values for the streamdat attributes + do i=1, nstrms + if( nstrms == 1 ) then + mystrm='' + else + write(mystrm,'("I2")') i + endif + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%taxmode,label="taxmode"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%mapalgo,label="mapalgo"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%tInterpAlgo,label="tInterpAlgo"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%readMode,label="readMode"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if( ESMF_ConfigGetLen(config=CF, label="yearFirst"//mystrm, rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearFirst,label="yearFirst"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call shr_sys_abort("yearFirst must be provided") + endif + + if( ESMF_ConfigGetLen(config=CF, label="yearLast"//mystrm, rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearLast,label="yearLast"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call shr_sys_abort("yearLast must be provided") + endif + + if( ESMF_ConfigGetLen(config=CF, label="yearAlign"//mystrm, rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearAlign,label="yearAlign"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call shr_sys_abort("yearAlign must be provided") + endif + + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%dtlimit,label="dtlimit"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%offset,label="stream_offset"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if( ESMF_ConfigGetLen(config=CF, label="stream_mesh_file"//mystrm, rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%meshfile,label="stream_mesh_file"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call shr_sys_abort("stream_mesh_file must be provided") + endif + + if( ESMF_ConfigGetLen(config=CF, label="stream_vectors"//mystrm, rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%stream_vectors,label="stream_vectors"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call shr_sys_abort("stream_vectors must be provided") + endif + + if( ESMF_ConfigGetLen(config=CF, label="stream_lev_dimname"//mystrm, rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%lev_dimname,label="stream_lev_dimname"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call shr_sys_abort("stream_lev_dimname must be provided") + endif + + ! Get a list of stream file names + streamdat(i)%nfiles = ESMF_ConfigGetLen(config=CF, label="stream_data_files"//mystrm, rc=rc) + if( streamdat(i)%nfiles > 0) then + allocate(streamdat(i)%file( streamdat(i)%nfiles)) + allocate(strm_tmpstrings(streamdat(i)%nfiles)) + call ESMF_ConfigGetAttribute(CF,valueList=strm_tmpstrings, label="stream_data_files"//mystrm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do n=1,streamdat(i)%nfiles + streamdat(i)%file(n)%name = trim(strm_tmpstrings(i)) + enddo + deallocate(strm_tmpstrings) + else + call shr_sys_abort("stream data files must be provided") + endif + + ! Get name of stream variables in file and model + streamdat(i)%nvars = ESMF_ConfigGetLen(config=CF, label="stream_data_variables"//mystrm, rc=rc) + if( streamdat(i)%nvars > 0) then + allocate(streamdat(i)%varlist(streamdat(i)%nvars)) + allocate(strm_tmpstrings(streamdat(i)%nvars)) + call ESMF_ConfigGetAttribute(CF,valueList=strm_tmpstrings,label="stream_data_variables"//mystrm, rc=rc) + do n=1, streamdat(i)%nvars + streamdat(i)%varlist(n)%nameinfile = strm_tmpstrings(n)(1:index(trim(strm_tmpstrings(n)), " ")) + streamdat(i)%varlist(n)%nameinmodel = strm_tmpstrings(n)(index(trim(strm_tmpstrings(n)), " ", .true.)+1:) + enddo + else + call shr_sys_abort("stream data variables must be provided") + endif + + ! Initialize stream pio + streamdat(i)%pio_subsystem => pio_subsystem + streamdat(i)%pio_iotype = io_type + streamdat(i)%pio_ioformat = io_format + call shr_stream_getCalendar(streamdat(i), 1, streamdat(i)%calendar) + + ! Error check + if (trim(streamdat(i)%taxmode) == shr_stream_taxis_extend .and. streamdat(i)%dtlimit < 1.e10) then + call shr_sys_abort(trim(subName)//" ERROR: if taxmode value is extend set dtlimit to 1.e30") + end if + + enddo ! end loop nstrm + + ! Set logunit + streamdat(:)%logunit = logunit + + ! initialize flag that stream has been set + streamdat(:)%init = .true. + + end subroutine shr_stream_init_from_esmfconfig !=============================================================================== subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, & mDateLB, dDateLB, secLB, n_lb, fileLB, mDateUB, dDateUB, secUB, n_ub, fileUB) From 6e439bc36e70e2c4608d43613ef53ac2ad850cba Mon Sep 17 00:00:00 2001 From: BinLi-NOAA Date: Tue, 20 Apr 2021 13:36:15 -0400 Subject: [PATCH 08/10] Revised streams/dshr_stream_mod.F90. (#19) --- streams/dshr_stream_mod.F90 | 50 +++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/streams/dshr_stream_mod.F90 b/streams/dshr_stream_mod.F90 index dd0410b47..9a69c84a7 100644 --- a/streams/dshr_stream_mod.F90 +++ b/streams/dshr_stream_mod.F90 @@ -562,77 +562,73 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit, ! fill in non-default values for the streamdat attributes do i=1, nstrms - if( nstrms == 1 ) then - mystrm='' - else - write(mystrm,'("I2")') i - endif - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%taxmode,label="taxmode"//mystrm, rc=rc) + write(mystrm,"(I2.2)") i + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%taxmode,label="taxmode"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%mapalgo,label="mapalgo"//mystrm, rc=rc) + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%mapalgo,label="mapalgo"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%tInterpAlgo,label="tInterpAlgo"//mystrm, rc=rc) + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%tInterpAlgo,label="tInterpAlgo"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%readMode,label="readMode"//mystrm, rc=rc) + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%readMode,label="readMode"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if( ESMF_ConfigGetLen(config=CF, label="yearFirst"//mystrm, rc=rc) > 0 ) then - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearFirst,label="yearFirst"//mystrm, rc=rc) + if( ESMF_ConfigGetLen(config=CF, label="yearFirst"//mystrm//':', rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearFirst,label="yearFirst"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else call shr_sys_abort("yearFirst must be provided") endif - if( ESMF_ConfigGetLen(config=CF, label="yearLast"//mystrm, rc=rc) > 0 ) then - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearLast,label="yearLast"//mystrm, rc=rc) + if( ESMF_ConfigGetLen(config=CF, label="yearLast"//mystrm//':', rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearLast,label="yearLast"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else call shr_sys_abort("yearLast must be provided") endif - if( ESMF_ConfigGetLen(config=CF, label="yearAlign"//mystrm, rc=rc) > 0 ) then - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearAlign,label="yearAlign"//mystrm, rc=rc) + if( ESMF_ConfigGetLen(config=CF, label="yearAlign"//mystrm//':', rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearAlign,label="yearAlign"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else call shr_sys_abort("yearAlign must be provided") endif - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%dtlimit,label="dtlimit"//mystrm, rc=rc) + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%dtlimit,label="dtlimit"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%offset,label="stream_offset"//mystrm, rc=rc) + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%offset,label="stream_offset"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if( ESMF_ConfigGetLen(config=CF, label="stream_mesh_file"//mystrm, rc=rc) > 0 ) then - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%meshfile,label="stream_mesh_file"//mystrm, rc=rc) + if( ESMF_ConfigGetLen(config=CF, label="stream_mesh_file"//mystrm//':', rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%meshfile,label="stream_mesh_file"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else call shr_sys_abort("stream_mesh_file must be provided") endif - if( ESMF_ConfigGetLen(config=CF, label="stream_vectors"//mystrm, rc=rc) > 0 ) then - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%stream_vectors,label="stream_vectors"//mystrm, rc=rc) + if( ESMF_ConfigGetLen(config=CF, label="stream_vectors"//mystrm//':', rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%stream_vectors,label="stream_vectors"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else call shr_sys_abort("stream_vectors must be provided") endif - if( ESMF_ConfigGetLen(config=CF, label="stream_lev_dimname"//mystrm, rc=rc) > 0 ) then - call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%lev_dimname,label="stream_lev_dimname"//mystrm, rc=rc) + if( ESMF_ConfigGetLen(config=CF, label="stream_lev_dimname"//mystrm//':', rc=rc) > 0 ) then + call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%lev_dimname,label="stream_lev_dimname"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else call shr_sys_abort("stream_lev_dimname must be provided") endif ! Get a list of stream file names - streamdat(i)%nfiles = ESMF_ConfigGetLen(config=CF, label="stream_data_files"//mystrm, rc=rc) + streamdat(i)%nfiles = ESMF_ConfigGetLen(config=CF, label="stream_data_files"//mystrm//':', rc=rc) if( streamdat(i)%nfiles > 0) then allocate(streamdat(i)%file( streamdat(i)%nfiles)) allocate(strm_tmpstrings(streamdat(i)%nfiles)) - call ESMF_ConfigGetAttribute(CF,valueList=strm_tmpstrings, label="stream_data_files"//mystrm, rc=rc) + call ESMF_ConfigGetAttribute(CF,valueList=strm_tmpstrings, label="stream_data_files"//mystrm//':', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do n=1,streamdat(i)%nfiles streamdat(i)%file(n)%name = trim(strm_tmpstrings(i)) @@ -643,11 +639,11 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit, endif ! Get name of stream variables in file and model - streamdat(i)%nvars = ESMF_ConfigGetLen(config=CF, label="stream_data_variables"//mystrm, rc=rc) + streamdat(i)%nvars = ESMF_ConfigGetLen(config=CF, label="stream_data_variables"//mystrm//':', rc=rc) if( streamdat(i)%nvars > 0) then allocate(streamdat(i)%varlist(streamdat(i)%nvars)) allocate(strm_tmpstrings(streamdat(i)%nvars)) - call ESMF_ConfigGetAttribute(CF,valueList=strm_tmpstrings,label="stream_data_variables"//mystrm, rc=rc) + call ESMF_ConfigGetAttribute(CF,valueList=strm_tmpstrings,label="stream_data_variables"//mystrm//':', rc=rc) do n=1, streamdat(i)%nvars streamdat(i)%varlist(n)%nameinfile = strm_tmpstrings(n)(1:index(trim(strm_tmpstrings(n)), " ")) streamdat(i)%varlist(n)%nameinmodel = strm_tmpstrings(n)(index(trim(strm_tmpstrings(n)), " ", .true.)+1:) From d381a780eba1571e5db80ff30f4537a4bc08b4d3 Mon Sep 17 00:00:00 2001 From: BinLi-NOAA Date: Mon, 26 Apr 2021 14:03:32 -0400 Subject: [PATCH 09/10] Update emc/develop branch to include most recent updates from ESCOMP/CDEPS (#23) --- .github/workflows/bumpversion.yml | 20 + CMakeLists.txt | 14 +- cime_config/buildlib | 2 +- cime_config/stream_cdeps.py | 28 +- datm/CMakeLists.txt | 1 + datm/atm_comp_nuopc.F90 | 127 +++-- datm/cime_config/buildnml | 25 +- datm/cime_config/namelist_definition_datm.xml | 44 +- datm/cime_config/stream_definition_datm.xml | 446 ++++++++++++----- .../testmods_dirs/datm/scam/shell_commands | 1 - datm/datm_datamode_clmncep_mod.F90 | 13 +- datm/datm_datamode_jra_mod.F90 | 7 - dice/CMakeLists.txt | 7 +- dice/cime_config/buildnml | 21 +- dice/cime_config/namelist_definition_dice.xml | 19 +- dice/dice_datamode_ssmi_mod.F90 | 1 - dice/ice_comp_nuopc.F90 | 99 ++-- dlnd/CMakeLists.txt | 7 +- dlnd/cime_config/buildnml | 13 +- dlnd/cime_config/config_component.xml | 8 +- dlnd/cime_config/namelist_definition_dlnd.xml | 14 - dlnd/cime_config/stream_definition_dlnd.xml | 4 +- dlnd/lnd_comp_nuopc.F90 | 45 +- docn/CMakeLists.txt | 7 +- docn/cime_config/buildnml | 15 +- docn/cime_config/config_component.xml | 13 + docn/cime_config/namelist_definition_docn.xml | 23 +- docn/cime_config/stream_definition_docn.xml | 4 +- docn/docn_datamode_som_mod.F90 | 3 - docn/ocn_comp_nuopc.F90 | 89 ++-- drof/CMakeLists.txt | 7 +- drof/cime_config/buildnml | 14 +- drof/cime_config/config_component.xml | 29 +- drof/cime_config/namelist_definition_drof.xml | 15 - drof/cime_config/stream_definition_drof.xml | 130 ++++- drof/rof_comp_nuopc.F90 | 42 +- dshr/CMakeLists.txt | 7 +- dshr/dshr_mod.F90 | 471 ++++-------------- dwav/CMakeLists.txt | 7 +- dwav/cime_config/buildnml | 13 +- dwav/cime_config/namelist_definition_dwav.xml | 15 - dwav/wav_comp_nuopc.F90 | 41 +- share/CMakeLists.txt | 39 +- streams/CMakeLists.txt | 13 +- streams/dshr_strdata_mod.F90 | 7 +- 45 files changed, 968 insertions(+), 1002 deletions(-) create mode 100644 .github/workflows/bumpversion.yml diff --git a/.github/workflows/bumpversion.yml b/.github/workflows/bumpversion.yml new file mode 100644 index 000000000..c682973c4 --- /dev/null +++ b/.github/workflows/bumpversion.yml @@ -0,0 +1,20 @@ +name: Bump version +on: + push: + branches: + - master +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - name: Bump version and push tag + uses: anothrNick/github-tag-action@1.26.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WITH_V: true + DEFAULT_BUMP: minor + RELEASE_BRANCHES: master + DRY_RUN: False diff --git a/CMakeLists.txt b/CMakeLists.txt index 733855ab2..f84f8c847 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,9 @@ if(BLD_STANDALONE) list(APPEND EXTRA_LIBS cdeps_share) list(APPEND EXTRA_INCLUDES "${CMAKE_BINARY_DIR}/share" ) endif() - +if("${COMPILER}" STREQUAL "nag") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D__NAG__") +endif() add_subdirectory(fox) add_subdirectory(streams) add_subdirectory(dshr) @@ -81,11 +83,12 @@ foreach(COMP datm dice dlnd docn drof dwav) target_include_directories(${COMP} PUBLIC $ $) - install(TARGETS ${COMP} + install(TARGETS ${COMP} EXPORT ${COMP} + ARCHIVE DESTINATION lib LIBRARY DESTINATION lib COMPONENT Library) - install(EXPORT ${COMP} + install(EXPORT ${COMP} DESTINATION lib/cmake) endforeach(COMP) @@ -93,10 +96,11 @@ foreach(DEPS streams dshr cdeps_share FoX_dom FoX_wxml FoX_sax FoX_common FoX_ut if(NOT BLD_STANDALONE AND ${DEPS} STREQUAL "cdeps_share") continue() endif() - install(TARGETS ${DEPS} + install(TARGETS ${DEPS} EXPORT ${DEPS} + ARCHIVE DESTINATION lib LIBRARY DESTINATION lib COMPONENT Library) - install(EXPORT ${DEPS} + install(EXPORT ${DEPS} DESTINATION lib/cmake) endforeach(DEPS) diff --git a/cime_config/buildlib b/cime_config/buildlib index c3ca2780a..72a21593c 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -89,7 +89,7 @@ def buildlib(bldroot, libroot, case, compname=None): expect(time_counter <= time_to_wait," Timeout waiting for {}".format(dwav_lib)) print("HERE exeroot {} bldroot {}".format(exe_root, bldroot)) - s,o,e = run_cmd("make install DESTDIR={}".format(libroot), from_dir=bldroot, verbose=True) + s,o,e = run_cmd("make install VERBOSE=1 DESTDIR={}".format(libroot), from_dir=bldroot, verbose=True) expect(not s,"ERROR from make output={}, error={}".format(o,e)) # Link the CDEPS component directories to the location expected by cime diff --git a/cime_config/stream_cdeps.py b/cime_config/stream_cdeps.py index 3cbb2aa0b..d26c6722c 100644 --- a/cime_config/stream_cdeps.py +++ b/cime_config/stream_cdeps.py @@ -42,7 +42,7 @@ """ - + class StreamCDEPS(GenericXML): def __init__(self, infile, schema): @@ -64,8 +64,12 @@ def create_stream_xml(self, stream_names, case, streams_xml_file, data_list_file stream_file.write('\n') # write contents of stream file for stream_name in stream_names: - if stream_name: - self.stream_nodes = super(StreamCDEPS,self).get_child("stream_entry", {"name" : stream_name}, + if stream_name.startswith("NEON."): + self.stream_nodes = super(StreamCDEPS,self).get_child("stream_entry", {"name" : "NEON.$NEONSITE"}, + err_msg="No stream_entry {} found".format(stream_name)) + + elif stream_name: + self.stream_nodes = super(StreamCDEPS,self).get_child("stream_entry", {"name" : stream_name}, err_msg="No stream_entry {} found".format(stream_name)) # determine stream_year_first and stream_year_list @@ -99,10 +103,10 @@ def create_stream_xml(self, stream_names, case, streams_xml_file, data_list_file stream_datafiles = child.xml_element.text stream_datafiles = self._resolve_values(case, stream_datafiles) if 'first_year' in child.xml_element.attrib and 'last_year' in child.xml_element.attrib: - value = child.xml_element.get('first_year') + value = child.xml_element.get('first_year') value = self._resolve_values(case, value) stream_year_first= int(value) - value = child.xml_element.get('last_year') + value = child.xml_element.get('last_year') value = self._resolve_values(case, value) stream_year_last = int(value) year_first = max(stream_year_first, data_year_first) @@ -110,15 +114,15 @@ def create_stream_xml(self, stream_names, case, streams_xml_file, data_list_file stream_datafiles = self._sub_paths(stream_datafiles, year_first, year_last) stream_datafiles = stream_datafiles.strip() #endif - if stream_vars[node_name]: + if stream_vars[node_name]: stream_vars[node_name] += "\n " + self._add_xml_delimiter(stream_datafiles.split("\n"), "file") else: stream_vars[node_name] = self._add_xml_delimiter(stream_datafiles.split("\n"), "file") elif ( node_name == 'stream_meshfile' - or node_name == 'stream_mapalgo' - or node_name == 'stream_tintalgo' - or node_name == 'stream_taxmode' + or node_name == 'stream_mapalgo' + or node_name == 'stream_tintalgo' + or node_name == 'stream_taxmode' or node_name == 'stream_dtlimit'): attributes['model_grid'] = case.get_value("GRID") attributes['compset'] = case.get_value("COMPSET") @@ -130,7 +134,7 @@ def create_stream_xml(self, stream_names, case, streams_xml_file, data_list_file elif node_name.strip(): # Get the other dependencies stream_dict = self._add_value_to_dict(stream_vars, case, node) - + # append to stream xml file stream_file_text = _stream_nuopc_file_template.format(**stream_vars) with open(streams_xml_file, 'a') as stream_file: @@ -193,7 +197,7 @@ def _get_input_file_hash(self, data_list_file): def _get_value_match(self, node, child_name, attributes=None, exact_match=False): ''' - Get the first best match for multiple tags in child_name based on the + Get the first best match for multiple tags in child_name based on the attributes input @@ -396,5 +400,3 @@ def _add_xml_delimiter(list_to_deliminate, delimiter): #endif #endfor return "\n ".join(list_to_deliminate) - - diff --git a/datm/CMakeLists.txt b/datm/CMakeLists.txt index 3f78d8026..6cc1d2ea2 100644 --- a/datm/CMakeLists.txt +++ b/datm/CMakeLists.txt @@ -27,3 +27,4 @@ target_include_directories (datm PRIVATE ${CMAKE_SOURCE_DIR}) target_include_directories (datm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) target_include_directories (datm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/streams) target_include_directories (datm PRIVATE ${PIO_Fortran_INCLUDE_DIR}) +target_include_directories (datm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) diff --git a/datm/atm_comp_nuopc.F90 b/datm/atm_comp_nuopc.F90 index 0e896454f..0e7069bb0 100644 --- a/datm/atm_comp_nuopc.F90 +++ b/datm/atm_comp_nuopc.F90 @@ -19,11 +19,11 @@ module atm_comp_nuopc use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, setVM use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_const_mod , only : shr_const_cday use shr_sys_mod , only : shr_sys_abort - use shr_cal_mod , only : shr_cal_ymd2date, shr_cal_ymd2julian, shr_cal_date2julian + use shr_cal_mod , only : shr_cal_ymd2date use shr_mpi_mod , only : shr_mpi_bcast use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_config, shr_strdata_advance @@ -81,7 +81,7 @@ module atm_comp_nuopc private ! except public :: SetServices - + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -115,7 +115,6 @@ module atm_comp_nuopc character(CL) :: dataMode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from integer :: iradsw = 0 ! radiation interval (input namelist) character(CL) :: factorFn_mesh = 'null' ! file containing correction factors mesh character(CL) :: factorFn_data = 'null' ! file containing correction factors data @@ -218,7 +217,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) !------------------------------------------------------------------------------- namelist / datm_nml / datamode, & - model_meshfile, model_maskfile, model_createmesh_fromfile, & + model_meshfile, model_maskfile, & nx_global, ny_global, restfilm, iradsw, factorFn_data, factorFn_mesh, & flds_presaero, flds_co2, flds_wiso, bias_correct, anomaly_forcing @@ -252,7 +251,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_mpi_bcast(datamode , mpicom, 'datamode') call shr_mpi_bcast(model_meshfile , mpicom, 'model_meshfile') call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') - call shr_mpi_bcast(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') call shr_mpi_bcast(nx_global , mpicom, 'nx_global') call shr_mpi_bcast(ny_global , mpicom, 'ny_global') call shr_mpi_bcast(iradsw , mpicom, 'iradsw') @@ -265,49 +263,21 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out if (my_task == master_task) then - write(logunit,F00)' case_name = ',trim(case_name) - write(logunit,F00)' datamode = ',trim(datamode) - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if - write(logunit,F01)' nx_global = ',nx_global - write(logunit,F01)' ny_global = ',ny_global - write(logunit,F00)' restfilm = ',trim(restfilm) - write(logunit,F01)' iradsw = ',iradsw - write(logunit,F00)' factorFn_data = ',trim(factorFn_data) - write(logunit,F00)' factorFn_mesh = ',trim(factorFn_mesh) - write(logunit,F02)' flds_presaero = ',flds_presaero - write(logunit,F02)' flds_co2 = ',flds_co2 - write(logunit,F02)' flds_wiso = ',flds_wiso + write(logunit,F00)' case_name = ',trim(case_name) + write(logunit,F00)' datamode = ',trim(datamode) + write(logunit,F00)' model_meshfile = ',trim(model_meshfile) + write(logunit,F00)' model_maskfile = ',trim(model_maskfile) + write(logunit,F01)' nx_global = ',nx_global + write(logunit,F01)' ny_global = ',ny_global + write(logunit,F00)' restfilm = ',trim(restfilm) + write(logunit,F01)' iradsw = ',iradsw + write(logunit,F00)' factorFn_data = ',trim(factorFn_data) + write(logunit,F00)' factorFn_mesh = ',trim(factorFn_mesh) + write(logunit,F02)' flds_presaero = ',flds_presaero + write(logunit,F02)' flds_co2 = ',flds_co2 + write(logunit,F02)' flds_wiso = ',flds_wiso end if - ! check that files exists - if (my_task == master_task) then - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if - endif - ! Validate sdat datamode if (masterproc) write(logunit,*) ' datm datamode = ',trim(datamode) if ( trim(datamode) == 'CORE2_NYF' .or. & @@ -378,6 +348,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) real(R8) :: orbLambm0 ! orb mean long of perhelion (radians) real(R8) :: orbObliqr ! orb obliquity (radians) logical :: isPresent, isSet + real(R8) :: dayofYear character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -387,8 +358,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, compid, and logunit call ESMF_TraceRegionEnter('datm_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ATM', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type @@ -412,7 +382,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Get the time to interpolate the stream data to call ESMF_ClockGet( clock, currTime=currTime, timeStep=timeStep, advanceCount=stepno, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeGet(currTime, yy=current_year, mm=current_mon, dd=current_day, s=current_tod, rc=rc ) + call ESMF_TimeGet(currTime, yy=current_year, mm=current_mon, dd=current_day, s=current_tod, & + dayofYear_r8=dayofYear, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(current_year, current_mon, current_day, current_ymd) @@ -447,7 +418,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call shr_sys_abort(subname//'Need to set attribute ScalarFieldIdxNextSwCday') endif - nextsw_cday = getNextRadCDay( current_ymd, current_tod, stepno, idt, iradsw, sdat%model_calendar ) + nextsw_cday = getNextRadCDay(dayofYear, current_tod, stepno, idt, iradsw) call dshr_state_SetScalar(nextsw_cday, flds_scalar_index_nextsw_cday, exportState, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -477,6 +448,7 @@ subroutine ModelAdvance(gcomp, rc) real(R8) :: orbMvelpp ! orb moving vernal eq (radians) real(R8) :: orbLambm0 ! orb mean long of perhelion (radians) real(R8) :: orbObliqr ! orb obliquity (radians) + real(R8) :: dayofYear character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' !------------------------------------------------------------------------------- @@ -495,7 +467,7 @@ subroutine ModelAdvance(gcomp, rc) call ESMF_ClockGet( clock, currTime=currTime, timeStep=timeStep, advanceCount=stepno, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return nextTime = currTime + timeStep - call ESMF_TimeGet( nextTime, yy=yr, mm=mon, dd=day, s=next_tod, rc=rc ) + call ESMF_TimeGet( nextTime, yy=yr, mm=mon, dd=day, s=next_tod, dayofYear_r8=dayofYear, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yr, mon, day, next_ymd) @@ -525,7 +497,9 @@ subroutine ModelAdvance(gcomp, rc) ! Update nextsw_cday for scalar data ! Use nextYMD and nextTOD here since since the component - clock is advance at the END of the time interval - nextsw_cday = getNextRadCDay( next_ymd, next_tod, stepno, idt, iradsw, sdat%model_calendar ) + + nextsw_cday = getNextRadCDay(dayofYear, next_tod, stepno, idt, iradsw) + call dshr_state_SetScalar(nextsw_cday, flds_scalar_index_nextsw_cday, exportState, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -677,23 +651,18 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe case('CORE2_NYF','CORE2_IAF') call datm_datamode_core2_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) - if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CORE_IAF_JRA') call datm_datamode_jra_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) - if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CLMNCEP') call datm_datamode_clmncep_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) - if (ChkErr(rc,__LINE__,u_FILE_u)) return case('CPLHIST') call datm_datamode_cplhist_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) - if (ChkErr(rc,__LINE__,u_FILE_u)) return case('ERA5') call datm_datamode_era5_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) - if (ChkErr(rc,__LINE__,u_FILE_u)) return case('GEFS') call datm_datamode_gefs_restart_write(case_name, inst_suffix, target_ymd, target_tod, & logunit, my_task, sdat) @@ -799,31 +768,47 @@ end subroutine datm_init_dfields end subroutine datm_comp_run !=============================================================================== - real(R8) function getNextRadCDay( ymd, tod, stepno, dtime, iradsw, calendar ) - - ! Return the calendar day of the next radiation time-step. - ! General Usage: nextswday = getNextRadCDay(curr_date) + real(R8) function getNextRadCDay( julday, tod, stepno, dtime, iradsw ) + + ! Return the calendar day of the next radiation time-step. + ! General Usage: nextswday = getNextRadCDay(curr_date) iradsw is + ! the frequency to update the next shortwave. in number of steps + ! (or hours if negative) Julian date. + ! -- values greater than 1 set + ! the next radiation to the present time plus 2 timesteps every iradsw + ! -- values less than 0 turn set the next radiation to the present time + ! plus two timesteps every -iradsw hours. + ! -- if iradsw is zero, the next radiation time is the + ! present time plus 1 timestep. ! input/output variables - integer , intent(in) :: ymd - integer , intent(in) :: tod - integer(i8), intent(in) :: stepno - integer , intent(in) :: dtime - integer , intent(in) :: iradsw - character(*),intent(in) :: calendar + real(r8) , intent(in) :: julday + integer , intent(in) :: tod + integer(i8) , intent(in) :: stepno + integer , intent(in) :: dtime + integer , intent(in) :: iradsw ! local variables real(R8) :: nextsw_cday - real(R8) :: julday integer :: liradsw + integer :: delta_radsw character(*),parameter :: subName = '(getNextRadCDay) ' !------------------------------------------------------------------------------- + ! Note that stepno is obtained via the advancecount argument to + ! ESMF_GetClock and is the number of times the ESMF_Clock has been + ! advanced. The ESMF clock is actually advanced an additional time + ! (in order to trigger alarms) in the routine dshr_set_runclock + ! which is the specialized routine for the model_lable_SetRunClock. + ! This is called each time the ModelAdvance phase is called. Hence + ! stepno is not used to trigger the calculation of nextsw_cday. + liradsw = iradsw if (liradsw < 0) liradsw = nint((-liradsw *3600._r8)/dtime) - call shr_cal_date2julian(ymd,tod,julday,calendar) + if (liradsw > 1) then - if (mod(stepno+1,liradsw) == 0 .and. stepno > 0) then + delta_radsw = liradsw * dtime + if (mod(tod+dtime,delta_radsw) == 0 .and. stepno > 0) then nextsw_cday = julday + 2*dtime/shr_const_cday else nextsw_cday = -1._r8 diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index 265274521..573655af0 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -69,15 +69,30 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path # Initialize namelist defaults config = {} - config['model_grid'] = model_grid + if 'CLM_USRDAT' in model_grid: + config['model_grid'] = 'CLM_USRDAT' + if case.get_value("NEONSITE"): + config['neon'] = "True" + else: + config['model_grid'] = model_grid + config['datm_mode'] = datm_mode config['datm_co2_tseries'] = datm_co2_tseries config['datm_presaero'] = datm_presaero - config['cime_model'] = get_model() - if case.get_value('PTS_MODE'): - config['mode'] = 'single_column' + + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) else: - config['mode'] = case.get_value("ATM_DOMAIN_MESH") + scol_lat = -999. + if case.get_value('ATM_DOMAIN_FILE'): + if scol_lon > -999. and scol_lat > -999. and case.get_value("ATM_DOMAIN_FILE") != "UNSET": + config['single_column'] = 'true' + else: + config['single_column'] = 'false' nmlgen.init_defaults(infile, config) diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index eaaf9290d..cfff5744b 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -37,16 +37,21 @@ 1PT.urbanc_alpha + + NEON.$NEONSITE + CORE2_NYF.GISS,CORE2_NYF.GXGXS,CORE2_NYF.NCEP CORE2_IAF.GCGCS.PREC,CORE2_IAF.GISS.LWDN,CORE2_IAF.GISS.SWDN,CORE2_IAF.GISS.SWUP,CORE2_IAF.NCEP.DN10,CORE2_IAF.NCEP.Q_10,CORE2_IAF.NCEP.SLP_,CORE2_IAF.NCEP.T_10,CORE2_IAF.NCEP.U_10,CORE2_IAF.NCEP.V_10,CORE2_IAF.CORE2.ArcFactor + + CORE_IAF_JRA_1p4_2018.GCGCS.PREC,CORE_IAF_JRA_1p4_2018.GISS.LWDN,CORE_IAF_JRA_1p4_2018.GISS.SWDN,CORE_IAF_JRA_1p4_2018.NCEP.Q_10,CORE_IAF_JRA_1p4_2018.NCEP.SLP_,CORE_IAF_JRA_1p4_2018.NCEP.T_10,CORE_IAF_JRA_1p4_2018.NCEP.U_10,CORE_IAF_JRA_1p4_2018.NCEP.V_10 + - CORE_IAF_JRA.PREC,CORE_IAF_JRA.LWDN,CORE_IAF_JRA.SWDN,CORE_IAF_JRA.Q_10,CORE_IAF_JRA.SLP_,CORE_IAF_JRA.T_10,CORE_IAF_JRA.U_10,CORE_IAF_JRA.V_10,CORE_IAF_JRA.CORE2.ArcFactor + CORE_IAF_JRA.PREC,CORE_IAF_JRA.LWDN,CORE_IAF_JRA.SWDN,CORE_IAF_JRA.Q_10,CORE_IAF_JRA.SLP_,CORE_IAF_JRA.T_10,CORE_IAF_JRA.U_10,CORE_IAF_JRA.V_10 - CORE_IAF_JRA_1p4_2018.GCGCS.PREC,CORE_IAF_JRA_1p4_2018.GISS.LWDN,CORE_IAF_JRA_1p4_2018.GISS.SWDN,CORE_IAF_JRA_1p4_2018.NCEP.Q_10,CORE_IAF_JRA_1p4_2018.NCEP.SLP_,CORE_IAF_JRA_1p4_2018.NCEP.T_10,CORE_IAF_JRA_1p4_2018.NCEP.U_10,CORE_IAF_JRA_1p4_2018.NCEP.V_10 CORE2_IAF.NCEP.DENS.SOFS,CORE2_IAF.NCEP.PSLV.SOFS,CORE2_IAF.PREC.SOFS.DAILY,CORE2_IAF.LWDN.SOFS.DAILY,CORE2_IAF.SWDN.SOFS.DAILY,CORE2_IAF.SWUP.SOFS.DAILY,CORE2_IAF.SHUM.SOFS.6HOUR,CORE2_IAF.TBOT.SOFS.6HOUR,CORE2_IAF.U.SOFS.6HOUR,CORE2_IAF.V.SOFS.6HOUR,CORE2_IAF.CORE2.ArcFactor @@ -63,7 +68,7 @@ char datm datm_nml - CLMNCEP,CORE2_NYF,CORE2_IAF,CORE_IAF_JRA,ERA5,CPLHIST + CLMNCEP,CORE2_NYF,CORE2_IAF,CORE_IAF_JRA,ERA5,CPLHIST,1PT general method that operates on the data. ----datamode = "CPLHIST"---- @@ -97,6 +102,7 @@ active-land-only simulations. ----datamode = "ERA5"---- Fifth generation ECMWF atmospheric reanalysis of the global climate + ----datamode = "CPLHIST" ---- @@ -105,13 +111,10 @@ CLMNCEP - - CORE2_NYF - CORE2_IAF - + CORE_IAF_JRA @@ -120,6 +123,9 @@ CPLHIST + + $DATM_MODE + @@ -133,8 +139,7 @@ $ATM_DOMAIN_MESH - null - null + null @@ -148,23 +153,7 @@ $ATM_DOMAIN_MESH - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE - - - - - char - streams - abs - datm_nml - - file specifying model mesh - - - null - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE - $ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE + null @@ -177,6 +166,7 @@ $ATM_NX + 1 @@ -189,8 +179,10 @@ $ATM_NY + 1 + char datm diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index 24af2bacd..b42425bbc 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -18,10 +18,10 @@ %ym => year-month from the range yearfirst to yearlast with all 12 months %ymd => year-month-day from the range yearfirst to yearlast with all 12 months - ****** + ****** NOTE: any entry that has %y, %ym or %ymd MUST have first_year and last_year syntax - ****** + ****** Each mode below, except for presaero, has a set of streams associated with it The presaero stream, is associated with all modes @@ -194,6 +194,48 @@ BC.QIAN.Precip --> + + + + + + + none + + + $DIN_LOC_ROOT/atm/cdeps/v1/$NEONSITE/%ym.nc + + + PRECTmms Faxa_precn + FSDS Faxa_swdn + ZBOT Sa_z + TBOT Sa_tbot + WIND Sa_wind + RH Sa_rh + PSRF Sa_pbot + FLDS Faxa_lwdn + + null + + none + + null + 2018 + 2018 + 2019 + 0 + + linear + + + extend + + + 1e30 + + single + + @@ -209,9 +251,8 @@ FSDS Faxa_swdn null - + bilinear - nn null $DATM_YR_ALIGN @@ -243,7 +284,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -279,7 +319,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -304,7 +343,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.c2016.0.5d.ESMFmesh_260520.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.cdf5.c2016.0.5d.ESMFmesh_c210330.nc $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Solar6Hrly/clmforc.cruncep.V7.c2016.0.5d.Solr.%ym.nc @@ -335,7 +374,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.c2016.0.5d.ESMFmesh_260520.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.cdf5.c2016.0.5d.ESMFmesh_c210330.nc $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/Precip6Hrly/clmforc.cruncep.V7.c2016.0.5d.Prec.%ym.nc @@ -366,7 +405,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.c2016.0.5d.ESMFmesh_260520.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/clmforc.cruncep.V7.cdf5.c2016.0.5d.ESMFmesh_c210330.nc $DIN_LOC_ROOT_CLMFORC/atm_forcing.datm7.cruncep_qianFill.0.5d.v7.c160715/TPHWL6Hrly/clmforc.cruncep.V7.c2016.0.5d.TPQWL.%ym.nc @@ -380,7 +419,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -416,7 +454,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -448,7 +485,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -483,7 +519,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -519,7 +554,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -551,7 +585,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -586,7 +619,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -611,7 +643,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.0.125d.v1.ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.cdf5.0.125d.v1.ESMFmesh_120620_c210330.nc $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Solar/ctsmforc.NLDAS2.0.125d.v1.Solr.%ym.nc @@ -642,7 +674,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.0.125d.v1.ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.cdf5.0.125d.v1.ESMFmesh_120620_c210330.nc $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/Precip/ctsmforc.NLDAS2.0.125d.v1.Prec.%ym.nc @@ -673,7 +705,7 @@ - $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.0.125d.v1.ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/ctsmforc.NLDAS2.cdf5.0.125d.v1.ESMFmesh_120620_c210330.nc $DIN_LOC_ROOT/atm/datm7/atm_forcing.datm7.NLDAS2.0.125d.v1/TPQWL/ctsmforc.NLDAS2.0.125d.v1.TPQWL.%ym.nc @@ -862,7 +894,6 @@ null bilinear - nn null 1979 @@ -894,7 +925,6 @@ null bilinear - nn null 1979 @@ -926,7 +956,6 @@ null bilinear - nn null 1979 @@ -951,7 +980,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.pr.ccsm4.rcp45.2006-2300.nc @@ -962,7 +991,6 @@ null bilinear - nn null 2006 @@ -983,7 +1011,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.tas.ccsm4.rcp45.2006-2300.nc @@ -994,7 +1022,6 @@ null bilinear - nn null 2006 @@ -1015,7 +1042,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.ps.ccsm4.rcp45.2006-2300.nc @@ -1026,7 +1053,6 @@ null bilinear - nn null 2006 @@ -1047,7 +1073,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.huss.ccsm4.rcp45.2006-2300.nc @@ -1058,7 +1084,6 @@ null bilinear - nn null 2006 @@ -1079,7 +1104,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.uas.ccsm4.rcp45.2006-2300.nc @@ -1090,7 +1115,6 @@ null bilinear - nn null 2006 @@ -1111,7 +1135,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.vas.ccsm4.rcp45.2006-2300.nc @@ -1122,7 +1146,6 @@ null bilinear - nn null 2006 @@ -1143,7 +1166,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.rsds.ccsm4.rcp45.2006-2300.nc @@ -1154,7 +1177,6 @@ null bilinear - nn null 2006 @@ -1175,7 +1197,7 @@ - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc/domain.permafrostRCN_P2_ESMFmesh_120620.nc + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.rlds.ccsm4.rcp45.2006-2300.nc @@ -1186,7 +1208,6 @@ null bilinear - nn null 2006 @@ -1224,7 +1245,6 @@ null bilinear - nn u:v 1 @@ -1256,7 +1276,6 @@ null bilinear - nn u:v 1 @@ -1293,7 +1312,6 @@ null bilinear - nn u:v 1 @@ -1329,7 +1347,6 @@ null bilinear - nn u:v 1 @@ -1361,7 +1378,6 @@ null bilinear - nn u:v 1 @@ -1393,7 +1409,6 @@ null bilinear - nn u:v 1 @@ -1425,7 +1440,6 @@ null bilinear - nn u:v 1 @@ -1457,7 +1471,6 @@ null bilinear - nn u:v 1 @@ -1489,7 +1502,6 @@ null bilinear - nn u:v 1 @@ -1521,7 +1533,6 @@ null bilinear - nn u:v 1 @@ -1553,7 +1564,6 @@ null bilinear - nn u:v 1 @@ -1585,7 +1595,6 @@ null bilinear - nn u:v 1 @@ -1617,7 +1626,6 @@ null bilinear - nn u:v 1 @@ -1650,7 +1658,6 @@ null bilinear - nn u:v 1 @@ -1683,7 +1690,6 @@ null bilinear - nn u:v 1 @@ -1716,7 +1722,6 @@ null bilinear - nn u:v 1 @@ -1749,7 +1754,6 @@ null bilinear - nn u:v 1 @@ -1784,7 +1788,6 @@ null bilinear - nn u:v 1 @@ -1819,7 +1822,6 @@ null bilinear - nn u:v 1 @@ -1854,7 +1856,6 @@ null bilinear - nn u:v 1 @@ -1889,7 +1890,6 @@ null bilinear - nn u:v 1 @@ -1924,7 +1924,6 @@ null bilinear - nn u:v 1 @@ -1959,7 +1958,6 @@ null bilinear - nn u:v 1 @@ -1991,7 +1989,6 @@ null bilinear - nn u:v 1 @@ -2018,16 +2015,16 @@ - - - + + + - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.%y.190528.nc prec Faxa_prec @@ -2035,12 +2032,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2054,12 +2050,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.%y.190528.nc lwdn Faxa_lwdn @@ -2067,12 +2063,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2086,12 +2081,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.%y.190528.nc swdn Faxa_swdn @@ -2099,12 +2094,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 -5400 coszen @@ -2118,12 +2112,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.%y.190528.nc q_10 Sa_shum @@ -2131,12 +2125,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2150,12 +2143,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.%y.190528.nc slp Sa_pslv @@ -2163,12 +2156,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2182,12 +2174,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.%y.190528.nc t_10 Sa_tbot @@ -2195,12 +2187,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2214,12 +2205,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.%y.190528.nc u_10 Sa_u @@ -2227,12 +2218,11 @@ null bilinear - nn u:v 1 1958 - 2016 + 2018 0 linear @@ -2246,12 +2236,12 @@ single - + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.%y.171019.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.%y.190528.nc v_10 Sa_v @@ -2259,7 +2249,41 @@ null bilinear - nn + + u:v + 1 + 1958 + 2018 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.prec.TL319.%y.171019.nc + + + prec Faxa_prec + + null + + bilinear u:v 1 @@ -2278,20 +2302,19 @@ single - + - $DIN_LOC_ROOT/share/meshes/T62_040121_ESMFmesh_c20190714.nc + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc - $DIN_LOC_ROOT/atm/datm7/CORE2/CORE2.t_10.ArcFactor.T62.1997-2004.nc + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.lwdn.TL319.%y.171019.nc - TarcFactor tarcf + lwdn Faxa_lwdn null bilinear - nn u:v 1 @@ -2305,7 +2328,193 @@ cycle - 1.e30 + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.swdn.TL319.%y.171019.nc + + + swdn Faxa_swdn + + null + + bilinear + + u:v + 1 + 1958 + 2016 + -5400 + + coszen + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.q_10.TL319.%y.171019.nc + + + q_10 Sa_shum + + null + + bilinear + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.slp.TL319.%y.171019.nc + + + slp Sa_pslv + + null + + bilinear + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.t_10.TL319.%y.171019.nc + + + t_10 Sa_tbot + + null + + bilinear + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.u_10.TL319.%y.171019.nc + + + u_10 Sa_u + + null + + bilinear + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc + + + $DIN_LOC_ROOT/ocn/jra55/v1.3_noleap/JRA.v1.3.v_10.TL319.%y.171019.nc + + + v_10 Sa_v + + null + + bilinear + + u:v + 1 + 1958 + 2016 + 0 + + linear + + + cycle + + + 1.5 single @@ -2361,7 +2570,6 @@ null bilinear - nn u:v @@ -2493,7 +2701,6 @@ null none - nn null 2015 @@ -2525,7 +2732,6 @@ null none - nn null 2015 @@ -2557,7 +2763,6 @@ null none - nn null 2015 @@ -2589,7 +2794,6 @@ null none - nn null 2015 @@ -2621,7 +2825,6 @@ null none - nn null 2015 @@ -2653,7 +2856,6 @@ null none - nn null 2015 @@ -2685,7 +2887,6 @@ null none - nn null 2015 @@ -2717,7 +2918,6 @@ null none - nn null 2015 @@ -2749,7 +2949,6 @@ null none - nn null 2015 @@ -2781,7 +2980,6 @@ null none - nn null 2015 @@ -2813,7 +3011,6 @@ null none - nn null 2015 @@ -2845,7 +3042,6 @@ null none - nn null 2015 @@ -2877,7 +3073,6 @@ null none - nn null 2015 @@ -2909,7 +3104,6 @@ null none - nn null 2015 @@ -2941,7 +3135,6 @@ null none - nn null 2015 @@ -2973,7 +3166,6 @@ null none - nn null 2015 @@ -3022,7 +3214,6 @@ null bilinear - nn null 1 @@ -3069,7 +3260,6 @@ null bilinear - nn null 1 @@ -3116,7 +3306,6 @@ null bilinear - nn null 1 @@ -3163,7 +3352,6 @@ null bilinear - nn null 1849 @@ -3210,7 +3398,6 @@ null bilinear - nn null 2015 @@ -3257,7 +3444,6 @@ null bilinear - nn null 2015 @@ -3304,7 +3490,6 @@ null bilinear - nn null 2015 @@ -3351,7 +3536,6 @@ null bilinear - nn null 2015 @@ -3398,7 +3582,6 @@ null bilinear - nn null 2015 @@ -3435,7 +3618,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3479,7 +3661,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3514,7 +3695,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3550,7 +3730,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3590,7 +3769,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3623,7 +3801,6 @@ null bilinear - nn null $DATM_YR_ALIGN @@ -3659,7 +3836,6 @@ null bilinear - nn null 1 diff --git a/datm/cime_config/testdefs/testmods_dirs/datm/scam/shell_commands b/datm/cime_config/testdefs/testmods_dirs/datm/scam/shell_commands index 8c3db56c2..3ebb269f8 100755 --- a/datm/cime_config/testdefs/testmods_dirs/datm/scam/shell_commands +++ b/datm/cime_config/testdefs/testmods_dirs/datm/scam/shell_commands @@ -2,7 +2,6 @@ # this should correspond to the forcing IOP coordinates ./xmlchange PTS_LON=206.0 ./xmlchange PTS_LAT=70.5 -./xmlchange PTS_MODE=TRUE # Specify the starting/ending time for the IOP # The complete time slice of IOP file is specified below diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index 3dd53e0e9..3db1165c9 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -349,6 +349,9 @@ subroutine datm_datamode_clmncep_advance(masterproc, logunit, mpicom, rc) rtmp = maxval(Sa_tbot(:)) call shr_mpi_max(rtmp, tbotmax, mpicom, 'datm_tbot', all=.true.) write(logunit,*) trim(subname),' tbotmax = ',tbotmax + if(tbotmax <= 0) then + call shr_sys_abort(subname//'ERROR: bad value in tbotmax') + endif ! determine anidrmax (see below for use) if (atm_prognostic) then @@ -401,12 +404,12 @@ subroutine datm_datamode_clmncep_advance(masterproc, logunit, mpicom, rc) e = strm_rh(n) * 0.01_r8 * datm_esat(tbot,tbot) qsat = (0.622_r8 * e)/(pbot - 0.378_r8 * e) Sa_shum(n) = qsat - if (associated(strm_rh_16O) .and. associated(strm_rh_18O) .and. associated(strm_rh_HDO)) then +! if (associated(strm_rh_16O) .and. associated(strm_rh_18O) .and. associated(strm_rh_HDO)) then ! for isotopic tracer specific humidity, expect a delta, just keep the delta from the input file - Sa_shum_wiso(1,n) = strm_rh_16O(n) - Sa_shum_wiso(2,n) = strm_rh_18O(n) - Sa_shum_wiso(3,n) = strm_rh_HDO(n) - end if +! Sa_shum_wiso(1,n) = strm_rh_16O(n) +! Sa_shum_wiso(2,n) = strm_rh_18O(n) +! Sa_shum_wiso(3,n) = strm_rh_HDO(n) +! end if else if (associated(strm_tdew)) then if (tdewmax < 50.0_r8) strm_tdew(n) = strm_tdew(n) + tkFrz e = datm_esat(strm_tdew(n),tbot) diff --git a/datm/datm_datamode_jra_mod.F90 b/datm/datm_datamode_jra_mod.F90 index 7f7815d04..6a29dba90 100644 --- a/datm/datm_datamode_jra_mod.F90 +++ b/datm/datm_datamode_jra_mod.F90 @@ -43,7 +43,6 @@ module datm_datamode_jra_mod ! stream data real(r8), pointer :: strm_prec(:) => null() real(r8), pointer :: strm_swdn(:) => null() - real(r8), pointer :: strm_tarcf(:) => null() ! othe module arrays real(R8), pointer :: yc(:) ! array of model latitudes @@ -145,8 +144,6 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_swdn , rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_strdata_get_stream_pointer( sdat, 'tarcf' , strm_tarcf , rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(exportState, 'Sa_z' , fldptr1=Sa_z , rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -185,10 +182,6 @@ subroutine datm_datamode_jra_init_pointers(exportState, sdat, rc) call shr_sys_abort(trim(subname)//'ERROR: prec and swdn must be in streams for CORE_IAF_JRA') endif - if (.not. associated(strm_tarcf)) then - call shr_sys_abort(trim(subname)//'ERROR: tarcf must be in an input stream for CORE_IAF_JRA') - endif - end subroutine datm_datamode_jra_init_pointers !=============================================================================== diff --git a/dice/CMakeLists.txt b/dice/CMakeLists.txt index bd24a640b..3118c33e2 100644 --- a/dice/CMakeLists.txt +++ b/dice/CMakeLists.txt @@ -17,8 +17,9 @@ add_library(dice ${SRCFILES}) add_dependencies(dice dshr streams) target_include_directories (dice PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../fox/include") +target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../dshr") target_include_directories (dice PRIVATE "${CMAKE_SOURCE_DIR}") -target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") -target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../share") +target_include_directories (dice PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../streams") target_include_directories (dice PRIVATE "${PIO_Fortran_INCLUDE_DIR}") diff --git a/dice/cime_config/buildnml b/dice/cime_config/buildnml index aca70e45e..9bde0755b 100755 --- a/dice/cime_config/buildnml +++ b/dice/cime_config/buildnml @@ -63,15 +63,20 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config = {} config['ice_grid'] = ice_grid config['dice_mode'] = dice_mode - config['set_model_maskfile'] = 'false' - if case.get_value('PTS_MODE'): - config['mode'] = 'single_column' - config['set_model_maskfile'] = 'true' - else: - config['mode'] = case.get_value("ICE_DOMAIN_MESH") - if (ice_nx==atm_nx and ice_ny==atm_ny): - config['set_model_maskfile'] = 'true' + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) + else: + scol_lat = -999. + if case.get_value('ATM_DOMAIN_FILE'): + if scol_lon > -999. and scol_lat >= -999. and case.get_value("ATM_DOMAIN_FILE") != "UNSET": + config['single_column'] = 'true' + else: + config['single_column'] = 'false' # Initialize nmlgen nmlgen.init_defaults(infile, config) diff --git a/dice/cime_config/namelist_definition_dice.xml b/dice/cime_config/namelist_definition_dice.xml index 7f375bfc1..64f68881a 100644 --- a/dice/cime_config/namelist_definition_dice.xml +++ b/dice/cime_config/namelist_definition_dice.xml @@ -54,8 +54,7 @@ file specifying model mesh $ICE_DOMAIN_MESH - null - null + null @@ -69,19 +68,7 @@ $MASK_MESH - - - - - char - streams - abs - dice_nml - file specifying if model mesh is to be created at runtime - - null - $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE - $ICE_DOMAIN_PATH/$ICE_DOMAIN_FILE + null @@ -94,6 +81,7 @@ $ICE_NX + 1 @@ -106,6 +94,7 @@ $ICE_NY + 1 diff --git a/dice/dice_datamode_ssmi_mod.F90 b/dice/dice_datamode_ssmi_mod.F90 index f48244bb7..6f15fc9c7 100644 --- a/dice/dice_datamode_ssmi_mod.F90 +++ b/dice/dice_datamode_ssmi_mod.F90 @@ -6,7 +6,6 @@ module dice_datamode_ssmi_mod use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort - use shr_cal_mod , only : shr_cal_date2julian use shr_const_mod , only : shr_const_pi, shr_const_spval, shr_const_tkfrz, shr_const_latice use shr_frz_mod , only : shr_frz_freezetemp use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_type diff --git a/dice/ice_comp_nuopc.F90 b/dice/ice_comp_nuopc.F90 index 2ebe8458d..7eef7caf8 100644 --- a/dice/ice_comp_nuopc.F90 +++ b/dice/ice_comp_nuopc.F90 @@ -11,14 +11,14 @@ module ice_comp_nuopc use ESMF , only : ESMF_AlarmIsRinging, ESMF_METHOD_INITIALIZE use ESMF , only : ESMF_ClockGet, ESMF_TimeGet, ESMF_MethodRemove, ESMF_MethodAdd use ESMF , only : ESMF_GridCompSetEntryPoint, operator(+), ESMF_AlarmRingerOff - use ESMF , only : ESMF_ClockGetAlarm + use ESMF , only : ESMF_ClockGetAlarm, ESMF_StateGet, ESMF_Field, ESMF_FieldGet use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise use NUOPC_Model , only : model_routine_SS => SetServices use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, SetVM use shr_kind_mod , only : r8=>shr_kind_r8, cxx=>shr_kind_cxx, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_const_mod , only : shr_const_pi use shr_sys_mod , only : shr_sys_abort @@ -41,7 +41,7 @@ module ice_comp_nuopc private ! except public :: SetServices - + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -73,7 +73,6 @@ module ice_comp_nuopc character(CL) :: dataMode ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from real(R8) :: flux_swpf ! short-wave penatration factor real(R8) :: flux_Qmin ! bound on melt rate logical :: flux_Qacc ! activates water accumulation/melt wrt Q @@ -90,6 +89,7 @@ module ice_comp_nuopc ! model mask and model fraction real(r8), pointer :: model_frac(:) => null() integer , pointer :: model_mask(:) => null() + logical :: valid_ice = .true. ! used for single column logic (ocn mask > 0) ! constants logical :: flds_i2o_per_cat ! .true. if select per ice thickness @@ -114,6 +114,7 @@ subroutine SetServices(gcomp, rc) !-------------------------------- rc = ESMF_SUCCESS + ! the NUOPC gcomp component will register the generic methods call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -170,7 +171,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) !------------------------------------------------------------------------------- namelist / dice_nml / case_name, datamode, & - model_meshfile, model_maskfile, model_createmesh_fromfile, & + model_meshfile, model_maskfile, & restfilm, nx_global, ny_global, flux_swpf, flux_Qmin, flux_Qacc, flux_Qacc0 rc = ESMF_SUCCESS @@ -201,12 +202,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out write(logunit,F00)' datamode = ',trim(datamode) - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if + write(logunit,F00)' model_meshfile = ',trim(model_meshfile) + write(logunit,F00)' model_maskfile = ',trim(model_maskfile) write(logunit,F01)' nx_global = ',nx_global write(logunit,F01)' ny_global = ',ny_global write(logunit,F03)' flux_swpf = ',flux_swpf @@ -214,43 +211,19 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logunit,F02)' flux_Qacc = ',flux_Qacc write(logunit,F03)' flux_Qacc0 = ',flux_Qacc0 write(logunit,F00)' restfilm = ',trim(restfilm) - - ! check that files exists - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if endif ! broadcast namelist input - call shr_mpi_bcast(datamode , mpicom, 'datamode') - call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') - call shr_mpi_bcast(model_meshfile , mpicom, 'model_meshfile') - call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') - call shr_mpi_bcast(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') - call shr_mpi_bcast(nx_global , mpicom, 'nx_global') - call shr_mpi_bcast(ny_global , mpicom, 'ny_global') - call shr_mpi_bcast(restfilm , mpicom, 'restfilm') - call shr_mpi_bcast(flux_swpf , mpicom, 'flux_swpf') - call shr_mpi_bcast(flux_Qmin , mpicom, 'flux_Qmin') - call shr_mpi_bcast(flux_Qacc , mpicom, 'flux_Qacc') - call shr_mpi_bcast(flux_Qacc0 , mpicom, 'flux_Qacc0') + call shr_mpi_bcast(datamode , mpicom, 'datamode') + call shr_mpi_bcast(model_meshfile , mpicom, 'model_meshfile') + call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') + call shr_mpi_bcast(nx_global , mpicom, 'nx_global') + call shr_mpi_bcast(ny_global , mpicom, 'ny_global') + call shr_mpi_bcast(restfilm , mpicom, 'restfilm') + call shr_mpi_bcast(flux_swpf , mpicom, 'flux_swpf') + call shr_mpi_bcast(flux_Qmin , mpicom, 'flux_Qmin') + call shr_mpi_bcast(flux_Qacc , mpicom, 'flux_Qacc') + call shr_mpi_bcast(flux_Qacc0 , mpicom, 'flux_Qacc0') ! Validate datamode if ( trim(datamode) == 'ssmi' .or. trim(datamode) == 'ssmi_iaf') then @@ -293,6 +266,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) real(R8) :: cosarg ! for setting ice temp pattern real(R8) :: jday, jday0 ! elapsed day counters integer :: model_dt ! integer model timestep + type(ESMF_Field) :: lfield + character(CL) ,pointer :: lfieldnamelist(:) => null() + integer :: fieldcount + real(r8), pointer :: fldptr(:) + integer :: n character(len=*), parameter :: F00 = "('ice_comp_nuopc: ')',8a)" character(len=*), parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -302,8 +280,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, logunit call ESMF_TraceRegionEnter('dice_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ICE', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type @@ -324,6 +301,30 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) subname//':diceImport', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! for single column, the target point might not be a point where the ice/ocn mask is > 0 + if (size(model_frac) == 1 .and. model_frac(1) == 0._r8) then + valid_ice = .false. + call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1, fieldCount + if (trim(lfieldnamelist(n)) /= flds_scalar_name) then + call ESMF_StateGet(exportState, itemName=trim(lfieldnamelist(n)), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, farrayPtr=fldptr, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr(:) = 0._r8 + end if + enddo + deallocate(lfieldnamelist) + ! ******************* + ! *** RETURN HERE *** + ! ******************* + RETURN + end if + ! Get the time to interpolate the stream data to call ESMF_ClockGet(clock, currTime=currTime, timeStep=timeStep, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -377,6 +378,10 @@ subroutine ModelAdvance(gcomp, rc) character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' !------------------------------------------------------------------------------- + if (.not. valid_ice) then + RETURN + end if + rc = ESMF_SUCCESS call ESMF_TraceRegionEnter(subname) diff --git a/dlnd/CMakeLists.txt b/dlnd/CMakeLists.txt index 92c20be7d..57e4426bd 100644 --- a/dlnd/CMakeLists.txt +++ b/dlnd/CMakeLists.txt @@ -15,8 +15,9 @@ add_library(dlnd ${SRCFILES}) add_dependencies(dlnd dshr streams) target_include_directories (dlnd PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../dshr") target_include_directories (dlnd PRIVATE "${CMAKE_SOURCE_DIR}") -target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") -target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../share") +target_include_directories (dlnd PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../streams") target_include_directories (dlnd PRIVATE "${PIO_Fortran_INCLUDE_DIR}") +target_include_directories (dlnd PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) diff --git a/dlnd/cime_config/buildnml b/dlnd/cime_config/buildnml index 667657784..941abcec5 100755 --- a/dlnd/cime_config/buildnml +++ b/dlnd/cime_config/buildnml @@ -63,8 +63,17 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['create_mesh'] = 'true' if case.get_value("LND_DOMAIN_MESH") == 'create_mesh' else 'false' # Do not allow single column mode for dlnd - expect(not case.get_value('PTS_MODE'), - "for DLND, single column mode is not allowed") + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) + else: + scol_lat = -999. + if (scol_lon > -999. and scol_lat > 999.): + expect(False, + "single column mode for DLND is not currently allowed") # Initialize nmlgen nmlgen.init_defaults(infile, config) diff --git a/dlnd/cime_config/config_component.xml b/dlnd/cime_config/config_component.xml index 129cfa551..6fc60c254 100644 --- a/dlnd/cime_config/config_component.xml +++ b/dlnd/cime_config/config_component.xml @@ -49,7 +49,7 @@ char UNSET - $DIN_LOC_ROOT/lnd/dlnd7/CPLHIST_SNO/i.e20.I1850Clm50Sp.f09_g17.001_c180502 + $DIN_LOC_ROOT/lnd/dlnd7/CPLHIST_SNO/b.e21.B1850.f09_g17.CMIP6-piControl.001_c210324 run_component_dlnd env_run.xml @@ -60,7 +60,7 @@ char UNSET - i.e20.I1850Clm50Sp.f09_g17.001 + b.e21.B1850.f09_g17.CMIP6-piControl.001 run_component_dlnd env_run.xml @@ -94,7 +94,7 @@ integer -999 - 1 + 1971 run_component_dlnd env_run.xml @@ -105,7 +105,7 @@ integer -999 - 30 + 2000 run_component_dlnd env_run.xml diff --git a/dlnd/cime_config/namelist_definition_dlnd.xml b/dlnd/cime_config/namelist_definition_dlnd.xml index 0072c3662..9efa1b853 100644 --- a/dlnd/cime_config/namelist_definition_dlnd.xml +++ b/dlnd/cime_config/namelist_definition_dlnd.xml @@ -63,20 +63,6 @@ - - char - streams - abs - dlnd_nml - - file specifying model mesh - - - null - $LND_DOMAIN_PATH/$LND_DOMAIN_FILE - - - integer streams diff --git a/dlnd/cime_config/stream_definition_dlnd.xml b/dlnd/cime_config/stream_definition_dlnd.xml index 74ec272fe..292d8834d 100644 --- a/dlnd/cime_config/stream_definition_dlnd.xml +++ b/dlnd/cime_config/stream_definition_dlnd.xml @@ -19,7 +19,9 @@ $LND_DOMAIN_MESH - $DLND_CPLHIST_DIR/$DLND_CPLHIST_CASE.cpl.hl2x1yr_glc.%y-01-01.nc + + $DLND_CPLHIST_DIR/$DLND_CPLHIST_CASE.cpl.hl2x1yr_glc.%y-01-01.nc l2x1yr_glc_Sl_tsrf%glc Sl_tsrf_elev%glc diff --git a/dlnd/lnd_comp_nuopc.F90 b/dlnd/lnd_comp_nuopc.F90 index f863e2c84..8f8649d9e 100644 --- a/dlnd/lnd_comp_nuopc.F90 +++ b/dlnd/lnd_comp_nuopc.F90 @@ -17,7 +17,7 @@ module lnd_comp_nuopc use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, SetVM use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort use shr_cal_mod , only : shr_cal_ymd2date @@ -36,7 +36,7 @@ module lnd_comp_nuopc private ! except public :: SetServices - + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -69,7 +69,6 @@ module lnd_comp_nuopc character(CL) :: dataMode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from character(CL) :: streamfilename ! filename to obtain stream info from character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from logical :: force_prognostic_true = .false. ! if true set prognostic true @@ -165,7 +164,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) character(*) , parameter :: F02 = "('(lnd_comp_nuopc) ',a,l6)" !------------------------------------------------------------------------------- - namelist / dlnd_nml / datamode, model_meshfile, model_maskfile, model_createmesh_fromfile, & + namelist / dlnd_nml / datamode, model_meshfile, model_maskfile, & nx_global, ny_global, restfilm, force_prognostic_true rc = ESMF_SUCCESS @@ -197,7 +196,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_mpi_bcast(datamode , mpicom, 'datamode') call shr_mpi_bcast(model_meshfile , mpicom, 'model_meshfile') call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') - call shr_mpi_bcast(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') call shr_mpi_bcast(nx_global , mpicom, 'nx_global') call shr_mpi_bcast(ny_global , mpicom, 'ny_global') call shr_mpi_bcast(restfilm , mpicom, 'restfilm') @@ -205,12 +203,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out if (my_task == master_task) then - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if + write(logunit,F00)' model_meshfile = ',trim(model_meshfile) + write(logunit,F00)' model_maskfile = ',trim(model_maskfile) write(logunit ,*)' datamode = ',datamode write(logunit ,*)' nx_global = ',nx_global write(logunit ,*)' ny_global = ',ny_global @@ -218,30 +212,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(logunit ,*)' force_prognostic_true = ',force_prognostic_true endif - ! Check that files exists - if (my_task == master_task) then - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if - endif - ! Validate sdat datamode if (trim(datamode) == 'copyall') then if (my_task == master_task) write(logunit,*) 'dlnd datamode = ',trim(datamode) @@ -283,13 +253,12 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize sdat call ESMF_TraceRegionEnter('dlnd_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'LND', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) ! Initialize stream data type streamfilename = 'dlnd.streams'//trim(inst_suffix) #ifndef DISABLE_FoX - streamfilename = trim(streamfilename)'.xml' + streamfilename = trim(streamfilename)//'.xml' #endif call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'LND', logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/docn/CMakeLists.txt b/docn/CMakeLists.txt index 71c011478..36ad40542 100644 --- a/docn/CMakeLists.txt +++ b/docn/CMakeLists.txt @@ -19,8 +19,9 @@ add_library(docn ${SRCFILES}) add_dependencies(docn dshr streams) target_include_directories (docn PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/dshr) +target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../dshr) target_include_directories (docn PRIVATE ${CMAKE_SOURCE_DIR}) -target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) -target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/streams) +target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../share) +target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../streams) target_include_directories (docn PRIVATE ${PIO_Fortran_INCLUDE_DIR}) +target_include_directories (docn PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) diff --git a/docn/cime_config/buildnml b/docn/cime_config/buildnml index 16066f7a3..816305ad2 100755 --- a/docn/cime_config/buildnml +++ b/docn/cime_config/buildnml @@ -67,9 +67,22 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['model_grid'] = model_grid config['ocn_grid'] = ocn_grid config['docn_mode'] = docn_mode - config['create_mesh'] = 'true' if case.get_value("OCN_DOMAIN_MESH") == 'create_mesh' else 'false' config['aqua_planet'] = 'true' if 'aquap' in docn_mode else 'false' + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) + else: + scol_lat = -999. + if case.get_value('ATM_DOMAIN_FILE'): + if scol_lon > -999. and scol_lat > -999. and case.get_value("ATM_DOMAIN_FILE") != "UNSET": + config['single_column'] = 'true' + else: + config['single_column'] = 'false' + nmlgen.init_defaults(infile, config) # Generate docn_in diff --git a/docn/cime_config/config_component.xml b/docn/cime_config/config_component.xml index 27ace8a99..8e5503db4 100644 --- a/docn/cime_config/config_component.xml +++ b/docn/cime_config/config_component.xml @@ -118,6 +118,19 @@ Sets globally constant SST value + + char + + unset + + $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.2degFV_c20170421.nc + $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.1degFV_c20170421.nc + + run_component_docn + env_run.xml + Sets SOM aquaplanet file + + char diff --git a/docn/cime_config/namelist_definition_docn.xml b/docn/cime_config/namelist_definition_docn.xml index aa5a050f5..dbf559068 100644 --- a/docn/cime_config/namelist_definition_docn.xml +++ b/docn/cime_config/namelist_definition_docn.xml @@ -18,8 +18,8 @@ prescribed interannual - som som_aquap + som aquapfile '' '' @@ -119,8 +119,7 @@ $OCN_DOMAIN_MESH - null - null + null @@ -135,21 +134,7 @@ $MASK_MESH $ATM_DOMAIN_MESH - - - - - char - streams - abs - docn_nml - - file specifying model mesh - - - null - $OCN_DOMAIN_PATH/$OCN_DOMAIN_FILE - $OCN_DOMAIN_PATH/$OCN_DOMAIN_FILE + null @@ -162,6 +147,7 @@ $OCN_NX + 1 @@ -174,6 +160,7 @@ $OCN_NY + 1 diff --git a/docn/cime_config/stream_definition_docn.xml b/docn/cime_config/stream_definition_docn.xml index a1be32f34..1f3866404 100644 --- a/docn/cime_config/stream_definition_docn.xml +++ b/docn/cime_config/stream_definition_docn.xml @@ -114,11 +114,9 @@ $DIN_LOC_ROOT/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc - $DIN_LOC_ROOT/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc - $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.2degFV_c20170421.nc - $DIN_LOC_ROOT/ocn/docn7/SOM/default.som.forcing.aquaplanet.Qflux0_h30_sstQOBS.1degFV_c20170421.nc + $DOCN_SOMAQP_DATAFILE T So_t diff --git a/docn/docn_datamode_som_mod.F90 b/docn/docn_datamode_som_mod.F90 index 790990fa6..3bb1563c9 100644 --- a/docn/docn_datamode_som_mod.F90 +++ b/docn/docn_datamode_som_mod.F90 @@ -7,7 +7,6 @@ module docn_datamode_som_mod use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort - use shr_cal_mod , only : shr_cal_date2julian use shr_const_mod , only : shr_const_cpsw, shr_const_rhosw, shr_const_TkFrz use shr_const_mod , only : shr_const_TkFrzSw, shr_const_latice, shr_const_ocn_ref_sal use shr_const_mod , only : shr_const_zsrflyr, shr_const_pi @@ -162,8 +161,6 @@ subroutine docn_datamode_som_init_pointers(importState, exportState, sdat, ocn_f if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(importState, 'Foxx_lwup' , fldptr1=Foxx_lwup , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call dshr_state_getfldptr(importState, 'Foxx_lwup' , fldptr1=Foxx_lwup , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(importState, 'Foxx_sen' , fldptr1=Foxx_sen , rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call dshr_state_getfldptr(importState, 'Foxx_lat' , fldptr1=Foxx_lat , rc=rc) diff --git a/docn/ocn_comp_nuopc.F90 b/docn/ocn_comp_nuopc.F90 index 86ad49a7e..46391bd36 100644 --- a/docn/ocn_comp_nuopc.F90 +++ b/docn/ocn_comp_nuopc.F90 @@ -11,13 +11,14 @@ module ocn_comp_nuopc use ESMF , only : ESMF_Alarm, ESMF_MethodRemove, ESMF_MethodAdd use ESMF , only : ESMF_GridCompSetEntryPoint, ESMF_ClockGetAlarm, ESMF_AlarmIsRinging use ESMF , only : ESMF_StateGet, operator(+), ESMF_AlarmRingerOff, ESMF_LogWrite + use ESMF , only : ESMF_Field, ESMF_FieldGet use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize use NUOPC , only : NUOPC_Advertise, NUOPC_CompAttributeGet use NUOPC_Model , only : model_routine_SS => SetServices use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, SetVM use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort use shr_cal_mod , only : shr_cal_ymd2date @@ -53,7 +54,7 @@ module ocn_comp_nuopc private ! except public :: SetServices - + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -86,7 +87,6 @@ module ocn_comp_nuopc character(CL) :: datamode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from real(R8) :: sst_constant_value ! sst constant value integer :: aquap_option ! if aqua-planet mode, option to use character(CL) :: restfilm = nullstr ! model restart file namelist @@ -101,6 +101,7 @@ module ocn_comp_nuopc ! model mask and model fraction real(r8), pointer :: model_frac(:) => null() integer , pointer :: model_mask(:) => null() + logical :: valid_ocn = .true. ! used for single column logic ! constants logical :: aquaplanet = .false. @@ -181,7 +182,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) !------------------------------------------------------------------------------- namelist / docn_nml / datamode, & - model_meshfile, model_maskfile, model_createmesh_fromfile, & + model_meshfile, model_maskfile, & restfilm, nx_global, ny_global, sst_constant_value rc = ESMF_SUCCESS @@ -213,44 +214,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out write(logunit,F00)' case_name = ',trim(case_name) write(logunit,F00)' datamode = ',trim(datamode) - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if + write(logunit,F00)' model_meshfile = ',trim(model_meshfile) + write(logunit,F00)' model_maskfile = ',trim(model_maskfile) write(logunit,F01)' nx_global = ',nx_global write(logunit,F01)' ny_global = ',ny_global write(logunit,F00)' restfilm = ',trim(restfilm) - - ! check that files exists - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if endif ! Broadcast namelist input call shr_mpi_bcast(datamode , mpicom, 'datamode') call shr_mpi_bcast(model_meshfile , mpicom, 'model_meshfile') call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') - call shr_mpi_bcast(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') call shr_mpi_bcast(nx_global , mpicom, 'nx_global') call shr_mpi_bcast(ny_global , mpicom, 'ny_global') call shr_mpi_bcast(restfilm , mpicom, 'restfilm') @@ -309,12 +283,17 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - type(ESMF_Time) :: currTime - integer :: current_ymd ! model date - integer :: current_year ! model year - integer :: current_mon ! model month - integer :: current_day ! model day - integer :: current_tod ! model sec into model date + type(ESMF_Time) :: currTime + integer :: current_ymd ! model date + integer :: current_year ! model year + integer :: current_mon ! model month + integer :: current_day ! model day + integer :: current_tod ! model sec into model date + type(ESMF_Field) :: lfield + character(CL) ,pointer :: lfieldnamelist(:) => null() + integer :: fieldcount + real(r8), pointer :: fldptr(:) + integer :: n character(len=*), parameter :: subname=trim(module_name)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -323,8 +302,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize model mesh, restart flag, logunit, model_mask and model_frac call ESMF_TraceRegionEnter('docn_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'OCN', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type if not aqua planet @@ -348,6 +326,30 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) subname//trim(modelname)//':Import', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! for single column, the target point might not be a valid ocn point + if (size(model_mask) == 1 .and. model_mask(1) == 0) then + valid_ocn = .false. + call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1, fieldCount + if (trim(lfieldnamelist(n)) /= flds_scalar_name) then + call ESMF_StateGet(exportState, itemName=trim(lfieldnamelist(n)), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, farrayPtr=fldptr, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr(:) = 0._r8 + end if + enddo + deallocate(lfieldnamelist) + ! ******************* + ! *** RETURN HERE *** + ! ******************* + RETURN + end if + ! Get the time to interpolate the stream data to call ESMF_ClockGet(clock, currTime=currTime, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -389,8 +391,13 @@ subroutine ModelAdvance(gcomp, rc) character(len=*),parameter :: subname=trim(module_name)//':(ModelAdvance) ' !------------------------------------------------------------------------------- + rc = ESMF_SUCCESS + if (.not. valid_ocn) then + RETURN + end if + call memcheck(subname, 5, my_task == master_task) ! query the Component for its clock, importState and exportState diff --git a/drof/CMakeLists.txt b/drof/CMakeLists.txt index 50bbb20f1..6186b2bff 100644 --- a/drof/CMakeLists.txt +++ b/drof/CMakeLists.txt @@ -15,8 +15,9 @@ add_library(drof ${SRCFILES}) add_dependencies(drof dshr streams) target_include_directories (drof PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../dshr") target_include_directories (drof PRIVATE "${CMAKE_SOURCE_DIR}") -target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") -target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../share") +target_include_directories (drof PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../streams") target_include_directories (drof PRIVATE "${PIO_Fortran_INCLUDE_DIR}") +target_include_directories (drof PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) diff --git a/drof/cime_config/buildnml b/drof/cime_config/buildnml index f7d567504..4d1455b19 100755 --- a/drof/cime_config/buildnml +++ b/drof/cime_config/buildnml @@ -60,11 +60,19 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path # Note: always use model mesh file to set mask for drof config = {} config['drof_mode'] = drof_mode - config['create_mesh'] = 'true' if case.get_value("ROF_DOMAIN_MESH") == 'create_mesh' else 'false' # Do not allow single column mode for drof - expect(not case.get_value('PTS_MODE'), - "for, DROF single column mode is not allowed") + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) + else: + scol_lat = -999. + if (scol_lon > -999. and scol_lat > 999.): + expect(False, + "single column mode for DROF is not currently allowed") # Initialize nmlgen nmlgen.init_defaults(infile, config) diff --git a/drof/cime_config/config_component.xml b/drof/cime_config/config_component.xml index 39e18c02e..7d0e8a62d 100644 --- a/drof/cime_config/config_component.xml +++ b/drof/cime_config/config_component.xml @@ -13,14 +13,22 @@ --> - Data runoff model + Data runoff model + NULL mode COREv2 normal year forcing: COREv2 interannual year forcing: COREv2 interannual year forcing: COREv2 interannual year forcing: COREv2 interannual year forcing: CPLHIST mode: + JRA55 interannual forcing, v1.4, through 2018 + JRA55 interannual forcing, v1.4, through 2018, no rofi around AIS + JRA55 interannual forcing, v1.4, through 2018, no rofl around AIS + JRA55 interannual forcing, v1.4, through 2018, no rofi or rofl around AIS JRA55 interannual forcing + JRA55 Repeat Year Forcing v1.3 1984-1985 + JRA55 Repeat Year Forcing v1.3 1990-1991 + JRA55 Repeat Year Forcing v1.3 2003-2004 @@ -34,9 +42,10 @@ char - CPLHIST,DIATREN_ANN_RX1,DIATREN_IAF_RX1,DIATREN_IAF_AIS00_RX1,DIATREN_IAF_AIS45_RX1,DIATREN_IAF_AIS55_RX1,IAF_JRA,IAF_JRA_1p4_2018 + CPLHIST,DIATREN_ANN_RX1,DIATREN_IAF_RX1,DIATREN_IAF_AIS00_RX1,DIATREN_IAF_AIS45_RX1,DIATREN_IAF_AIS55_RX1,IAF_JRA,IAF_JRA_1p4_2018,IAF_JRA_1p4_2018_AIS0ICE,IAF_JRA_1p4_2018_AIS0LIQ,IAF_JRA_1p4_2018_AIS0ROF,RYF8485_JRA,RYF9091_JRA,RYF0304_JRA,NULL DIATREN_ANN_RX1 + NULL DIATREN_ANN_RX1 DIATREN_ANN_AIS00_RX1 DIATREN_ANN_AIS45_RX1 @@ -48,15 +57,23 @@ CPLHIST IAF_JRA IAF_JRA_1p4_2018 + IAF_JRA_1p4_2018_AIS0ICE + IAF_JRA_1p4_2018_AIS0LIQ + IAF_JRA_1p4_2018_AIS0ROF + RYF8485_JRA + RYF9091_JRA + RYF0304_JRA + NULL run_component_drof env_run.xml - DROF mode. Values are CPLHIST, *_RX1. In *_RX1 mode, + DROF mode. Values are CPLHIST, *_RX1, and NULL. In *_RX1 mode, observational climatological or interannual 1-degree runoff data is used. In CPLHIST mode, runoff - data from a previous model run is read in. - In CPLHIST mode, runoff forcing data from a previous - model run is output by the coupler and read in by the data model. + data from a previous model run is read in. In NULL mode, the runoff + data is set to zero. In CPLHIST mode, runoff forcing data from a previous + model run is output by the coupler and read in by the data rof + model. In NULL mode, runoff forcing is set to zero and not used. The default is DIATREN_ANN_RX1. diff --git a/drof/cime_config/namelist_definition_drof.xml b/drof/cime_config/namelist_definition_drof.xml index be837ce15..4ce7daaff 100644 --- a/drof/cime_config/namelist_definition_drof.xml +++ b/drof/cime_config/namelist_definition_drof.xml @@ -51,7 +51,6 @@ $ROF_DOMAIN_MESH - null @@ -68,20 +67,6 @@ - - char - streams - abs - drof_nml - - file specifying model mesh - - - null - $ROF_DOMAIN_PATH/$ROF_DOMAIN_FILE - - - integer streams diff --git a/drof/cime_config/stream_definition_drof.xml b/drof/cime_config/stream_definition_drof.xml index 2a3efef97..8c3362a9d 100644 --- a/drof/cime_config/stream_definition_drof.xml +++ b/drof/cime_config/stream_definition_drof.xml @@ -320,7 +320,135 @@ $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc - $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.1.runoff.%y.170807.nc + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.%y.190214.nc + + + rofl Forr_rofl + rofi Forr_rofi + + null + + bilinear + + null + 1 + 1958 + 2018 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.%y.no_rofi.190214.nc + + + rofl Forr_rofl + rofi Forr_rofi + + null + + bilinear + + null + 1 + 1958 + 2018 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.%y.no_rofl.190214.nc + + + rofl Forr_rofl + rofi Forr_rofi + + null + + bilinear + + null + 1 + 1958 + 2018 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.%y.no_rofi.190214.nc + + + rofl Forr_rofl + rofi Forr_rofi + + null + + bilinear + + null + 1 + 1958 + 2018 + 0 + + upper + + + cycle + + + 3.0 + + single + + + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.1958_ESMFmesh_cdf5_20201020.nc + + + $DIN_LOC_ROOT/lnd/dlnd7/JRA55/JRA.v1.4.runoff.%y.no_rofi_no_rofl.190214.nc rofl Forr_rofl diff --git a/drof/rof_comp_nuopc.F90 b/drof/rof_comp_nuopc.F90 index a9937f1a6..5c901c5d0 100644 --- a/drof/rof_comp_nuopc.F90 +++ b/drof/rof_comp_nuopc.F90 @@ -17,7 +17,7 @@ module rof_comp_nuopc use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, SetVM use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_const_mod , only : SHR_CONST_SPVAL use shr_sys_mod , only : shr_sys_abort @@ -36,6 +36,7 @@ module rof_comp_nuopc private ! except public :: SetServices + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -66,7 +67,6 @@ module rof_comp_nuopc character(CL) :: dataMode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from character(CL) :: restfilm = nullstr ! model restart file namelist integer :: nx_global integer :: ny_global @@ -161,7 +161,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) character(*) ,parameter :: F02 = "('(rof_comp_nuopc) ',a,l6)" !------------------------------------------------------------------------------- - namelist / drof_nml / datamode, model_meshfile, model_maskfile, model_createmesh_fromfile, & + namelist / drof_nml / datamode, model_meshfile, model_maskfile, & restfilm, nx_global, ny_global rc = ESMF_SUCCESS @@ -192,44 +192,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out write(logunit,F00)' datamode = ',trim(datamode) - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if + write(logunit,F00)' model_meshfile = ',trim(model_meshfile) + write(logunit,F00)' model_maskfile = ',trim(model_maskfile) write(logunit,F01)' nx_global = ',nx_global write(logunit,F01)' ny_global = ',ny_global write(logunit,F00)' restfilm = ',trim(restfilm) - - ! check that files exists - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if - endif + end if ! broadcast namelist input call shr_mpi_bcast(datamode , mpicom, 'datamode') call shr_mpi_bcast(model_meshfile , mpicom, 'model_meshfile') call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') - call shr_mpi_bcast(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') call shr_mpi_bcast(nx_global , mpicom, 'nx_global') call shr_mpi_bcast(ny_global , mpicom, 'ny_global') call shr_mpi_bcast(restfilm , mpicom, 'restfilm') @@ -280,8 +253,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize mesh, restart flag, logunit call ESMF_TraceRegionEnter('drof_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ROF', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type diff --git a/dshr/CMakeLists.txt b/dshr/CMakeLists.txt index 05f94b901..3fb5fb8a8 100644 --- a/dshr/CMakeLists.txt +++ b/dshr/CMakeLists.txt @@ -19,9 +19,10 @@ endif() add_dependencies(dshr streams) target_include_directories (dshr PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (dshr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/streams) -target_include_directories (dshr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) +target_include_directories (dshr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../streams) +target_include_directories (dshr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../share) target_include_directories (dshr PRIVATE "${PIO_Fortran_INCLUDE_DIR}") install(TARGETS dshr - LIBRARY DESTINATION lib) \ No newline at end of file + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) diff --git a/dshr/dshr_mod.F90 b/dshr/dshr_mod.F90 index 72969d487..d950dc331 100644 --- a/dshr/dshr_mod.F90 +++ b/dshr/dshr_mod.F90 @@ -60,9 +60,9 @@ module dshr_mod public :: dshr_orbital_update public :: dshr_orbital_init - private :: dshr_mesh_create - private :: dshr_alarm_init - private :: dshr_time_init + private :: dshr_mesh_create_scol ! create mesh for single column mode + private :: dshr_alarm_init ! initialize alarms + private :: dshr_time_init ! initialize time ! Note that gridTofieldMap = 2, therefore the ungridded dimension is innermost @@ -212,8 +212,7 @@ end subroutine dshr_init !=============================================================================== subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, model_nyg, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, read_restart, rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, read_restart, rc) ! ---------------------------------------------- ! Initialize model mesh @@ -229,7 +228,6 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo integer , intent(in) :: model_nyg character(len=*) , intent(in) :: model_meshfile character(len=*) , intent(in) :: model_maskfile - character(len=*) , intent(in) :: model_createmesh_fromfile type(ESMF_Mesh) , intent(out) :: model_mesh integer , pointer , intent(out) :: model_mask(:) real(r8), pointer , intent(out) :: model_frac(:) @@ -238,25 +236,19 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo ! local variables type(ESMF_VM) :: vm - type(ESMF_Calendar) :: esmf_calendar ! esmf calendar + logical :: masterproc type(ESMF_DistGrid) :: distGrid - integer, pointer :: model_gindex(:) ! model global index spzce - integer :: mpicom integer :: my_task - logical :: scol_mode real(r8) :: scol_lon real(r8) :: scol_lat character(CL) :: cvalue - integer :: lsize ! local size of mesh - integer :: petcount + integer :: lsize ! local size of mesh type(ESMF_Array) :: elemMaskArray - type(file_desc_t) :: pioid - type(var_desc_t) :: varid - integer :: rcode logical :: isPresent, isSet - logical :: masterproc - character(len=*), parameter :: subname='(dshr_mod:dshr_mesh_init)' + logical :: exists ! check for file existence + real(r8) :: scol_spval = -999._r8 character(*) , parameter :: F00 ="('(dshr_mesh_init) ',a)" + character(len=*), parameter :: subname='(dshr_mod:dshr_mesh_init)' ! ---------------------------------------------- rc = ESMF_SUCCESS @@ -264,11 +256,11 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo ! generate local mpi comm call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMGet(vm, mpiCommunicator=mpicom, localPet=my_task, petcount=petcount, rc=rc) + call ESMF_VMGet(vm, localPet=my_task, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + masterproc = (my_task == master_task) ! Set restart flag - ! TODO: should this be a variable from the driver? call NUOPC_CompAttributeGet(gcomp, name='read_restart', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent .and. isSet) then @@ -277,66 +269,44 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo call shr_sys_abort(subname//' ERROR: read restart flag must be present') end if - masterproc = (my_task == master_task) - - ! Obtain the data model mesh - ! (1) if asked to create the mesh - ! - create mesh from input file given by model_createmesh_fromfile - ! - if single column find the nearest neighbor in model_createmesh_fromfile - ! (2) if not single column - obtain the mesh directly from the mesh input - ! - reset the model mesh if the model maskfile is not equal to the model mesh file + ! obtain the single column lon and lat + call NUOPC_CompAttributeGet(gcomp, name='scol_lon', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (isPresent .and. isSet) then + read(cvalue,*) scol_lon + else + scol_lon = scol_spval + end if + call NUOPC_CompAttributeGet(gcomp, name='scol_lat', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (isPresent .and. isSet) then + read(cvalue,*) scol_lat + else + scol_lat = scol_spval + end if - if (trim(model_meshfile) == nullstr) then + if (scol_lon > scol_spval .and. scol_lat > scol_spval) then - ! Get single column values - call NUOPC_CompAttributeGet(gcomp, name='single_column', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - read(cvalue,*) scol_mode - if (scol_mode) then - ! verify that ROF, WAV and LND are not trying to use single column mode - if (trim(compname) == 'ROF' .or. trim(compname) == 'LND' .or. trim(compname) == 'WAV') then - if (masterproc) then - write(logunit,*) subname,' ERROR: '//trim(compname)//' does not support single column mode ' - end if - call shr_sys_abort(subname//' ERROR: '//trim(compname)//' does not support single column mode ') - end if - - ! verify that are only using 1 pe - if (petcount > 1) then - if (masterproc) then - write(logunit,*) subname,' ERROR: single column mode must be run on one pe, petcount= ',petcount - end if - call shr_sys_abort(subname//' ERROR: single column mode must be run on 1 pe') - endif - - ! obtain the single column lon and lat - call NUOPC_CompAttributeGet(gcomp, name='scmlon', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scol_lon - call NUOPC_CompAttributeGet(gcomp, name='scmlat', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scol_lat - if (my_task == master_task) then - write(logunit,*) ' single column mode, lon lat = ',scol_mode, scol_lon, scol_lat - end if - else - scol_lon = shr_const_spval - scol_lat = shr_const_spval - end if - else - scol_mode = .false. - scol_lon = shr_const_spval - scol_lat = shr_const_spval - end if - - ! Now create the model meshfile - call dshr_mesh_create(trim(model_createmesh_fromfile), scol_mode, scol_lon, scol_lat, & - trim(compname), sdat, my_task, logunit, model_mesh, model_mask, model_frac, rc=rc) + ! This is simply a single point run + call dshr_mesh_create_scol(gcomp, compname, scol_lon, scol_lat, model_mesh, model_mask, model_frac, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else + ! check that model_meshfile and model_maskfile exists + if (my_task == master_task) then + inquire(file=trim(model_meshfile), exist=exists) + if (.not.exists) then + write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' + call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') + end if + inquire(file=trim(model_maskfile), exist=exists) + if (.not.exists) then + write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' + call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') + end if + endif + ! Read in the input model mesh model_mesh = ESMF_MeshCreate(trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -384,285 +354,78 @@ subroutine dshr_mesh_init(gcomp, sdat, nullstr, logunit, compname, model_nxg, mo end if end if - end subroutine dshr_mesh_init !=============================================================================== - subroutine dshr_mesh_create(filename, scol_mode, scol_lon, scol_lat, & - compname, sdat, my_task, logunit, model_mesh, model_mask, model_frac, rc) + subroutine dshr_mesh_create_scol(gcomp, compname, scol_lon, scol_lat, & + model_mesh, model_mask, model_frac, rc) - ! Create the model mesh from the domain file - for either single column mode - ! or for a regional grid + ! Create a single column mesh - the area is arbitrary ! input/output variables - character(len=*) , intent(in) :: filename - logical , intent(in) :: scol_mode + type(ESMF_GridComp) , intent(inout) :: gcomp + character(len=*) , intent(in) :: compname real(r8) , intent(inout) :: scol_lon real(r8) , intent(inout) :: scol_lat - character(len=*) , intent(in) :: compname - type(shr_strdata_type), intent(in) :: sdat - integer , intent(in) :: my_task - integer , intent(in) :: logunit type(ESMF_Mesh) , intent(out) :: model_mesh - integer , pointer , intent(out) :: model_mask(:) - real(r8), pointer , intent(out) :: model_frac(:) + integer , pointer , intent(inout) :: model_mask(:) + real(r8), pointer , intent(inout) :: model_frac(:) integer , intent(out) :: rc ! local variables - type(file_desc_t) :: pioid - integer :: rcode ! error code - type(var_desc_t) :: varid ! variable id - integer :: dimid ! dimension id - integer :: ni, nj, nv ! dimension sizes - integer :: i,j + type(ESMF_Grid) :: lgrid + character(CL) :: cvalue integer :: maxIndex(2) real(r8) :: mincornerCoord(2) real(r8) :: maxcornerCoord(2) - type(ESMF_Grid) :: lgrid - integer :: spatialDim ! number of dimension in mesh - integer :: numOwnedElements ! number of elements owned by this PET - real(r8), pointer :: ownedElemCoords(:) ! mesh element coordinates owned by this PET - integer :: n ! index - integer :: start(2) ! start index to read in for single column mode - integer :: count(2) ! number of points to read in - real(r8), allocatable :: xv(:,:,:), yv(:,:,:) ! coordinates of vertices - real(r8), allocatable :: xc(:,:), yc(:,:) ! coordinates of centers - real(r8) :: scol_data(1) ! temporary - integer , allocatable :: mask(:) ! temporary - real(r8), allocatable :: lats(:) ! temporary - real(r8), allocatable :: lons(:) ! temporary - real(r8), allocatable :: pos_lons(:) ! temporary - real(r8) :: pos_scol_lon ! temporary - real(r8) :: scol_area ! temporary - character(len=*), parameter :: subname='(dshr_mesh_create)' + character(len=*), parameter :: subname='(dshr_mesh_create_single_column)' ! ---------------------------------------------- rc = ESMF_SUCCESS - !------------------------------------- - ! open domain file and get dimensions - !------------------------------------- - - rcode = pio_openfile(sdat%pio_subsystem, pioid, sdat%io_type, trim(filename), pio_nowrite) - call pio_check_err(rcode, 'error opening file '//trim(filename)) - call PIO_seterrorhandling(pioid, PIO_BCAST_ERROR) - - rcode = pio_inq_dimid(pioid, 'ni', dimid) - call pio_check_err(rcode, 'pio_inq_dimid for ni in file '//trim(filename)) - rcode = pio_inquire_dimension(pioid, dimid, len=ni) - call pio_check_err(rcode, 'pio_inq_dimension for ni in file '//trim(filename)) - - rcode = pio_inq_dimid(pioid, 'nj', dimid) - call pio_check_err(rcode, 'pio_inq_dimid for nj in file '//trim(filename)) - rcode = pio_inquire_dimension(pioid, dimid, len=nj) - call pio_check_err(rcode, 'pio_inq_dimension for nj in file '//trim(filename)) - - rcode = pio_inq_dimid(pioid, 'nv', dimid) - call pio_check_err(rcode, 'pio_inq_dimid for nv in file '//trim(filename)) - rcode = pio_inquire_dimension(pioid, dimid, len=nv) - call pio_check_err(rcode, 'pio_inq_dimension for nv in file '//trim(filename)) - - !------------------------------------- - ! Single column model (size 1) - !------------------------------------- - - if (scol_mode) then - - ! get lons from domain file - rcode = pio_inq_varid(pioid, 'xc', varid) - call pio_check_err(rcode, 'pio_inq_varid for xc in file '//trim(filename)) - allocate(xc(ni,nj)) - rcode = pio_get_var(pioid, varid, xc) - call pio_check_err(rcode, 'pio_get_var for xc in file '//trim(filename)) - - ! get lats from domain file - rcode = pio_inq_varid(pioid, 'yc', varid) - call pio_check_err(rcode, 'pio_inq_varid for yc in file '//trim(filename)) - allocate(yc(ni,nj)) - rcode = pio_get_var(pioid, varid, yc) - call pio_check_err(rcode, 'pio_get_var for yc in file '//trim(filename)) - - ! find nearest neighbor indices of scol_lon and scol_lat in domain file - allocate(lats(nj)) - allocate(lons(ni)) - allocate(pos_lons(ni)) - do i = 1,ni - lons(i) = xc(i,1) - end do - do j = 1,nj - lats(j) = yc(1,j) - end do - pos_lons(:) = mod(lons(:) + 360._r8, 360._r8) - pos_scol_lon = mod(scol_lon + 360._r8, 360._r8) - start(1) = (MINLOC(abs(pos_lons - pos_scol_lon), dim=1)) - start(2) = (MINLOC(abs(lats -scol_lat ), dim=1)) - count(:) = 1 - deallocate(lons) - deallocate(lats) - - ! read in value of nearest neighbor lon and RESET scol_lat - rcode = pio_inq_varid(pioid, 'xc' , varid) - call pio_check_err(rcode, 'pio_inq_varid for xc in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, start, count, scol_data) - call pio_check_err(rcode, 'pio_get_var for xc in file '//trim(filename)) - scol_lon = scol_data(1) - - ! read in value of nearest neighbor lon and RESET scol_lon - rcode = pio_inq_varid(pioid, 'yc' , varid) - call pio_check_err(rcode, 'pio_inq_varid for yc in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, start, count, scol_data) - call pio_check_err(rcode, 'pio_get_var for yc in file '//trim(filename)) - scol_lat = scol_data(1) - - ! get area of gridcell - rcode = pio_inq_varid(pioid, 'area', varid) - call pio_check_err(rcode, 'pio_inq_varid for area in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, start, count, scol_data) - call pio_check_err(rcode, 'pio_get_var for area in file '//trim(filename)) - scol_area = scol_data(1) - - ! create the single column grid - maxIndex(1) = 1 ! number of lons - maxIndex(2) = 1 ! number of lats - mincornerCoord(1) = scol_lon - scol_area/2._r8 ! min lon - mincornerCoord(2) = scol_lat - scol_area/2._r8 ! min lat - maxcornerCoord(1) = scol_lon + scol_area/2._r8 ! max lon - maxcornerCoord(2) = scol_lat + scol_area/2._r8 ! max lat - - ! create the model grid - lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & - mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & - staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(model_mask(1)) + allocate(model_frac(1)) - ! create the mesh from the grid - model_mesh = ESMF_MeshCreate(lgrid, rc=rc) + if (compname == 'ATM') then + model_frac(1) = 1._r8 + model_mask(1) = 1 + else if (compname == 'LND') then + call NUOPC_CompAttributeGet(gcomp, name='scol_lndmask', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! For the ATM component - the fractions and masks are always 1 - don't read them - ! in or reset the mesh - - if (compname /= 'ATM') then - ! get model_mask - allocate(model_mask(1)) - rcode = pio_inq_varid(pioid, 'mask', varid) - call pio_check_err(rcode, 'pio_inq_varid for area in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, start, count, model_mask) - call pio_check_err(rcode, 'pio_get_var for area in file '//trim(filename)) - - ! get model_frac - allocate(model_frac(1)) - rcode = pio_inq_varid(pioid, 'frac', varid) - call pio_check_err(rcode, 'pio_inq_varid for area in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, start, count, model_frac) - call pio_check_err(rcode, 'pio_get_var for area in file '//trim(filename)) - - ! set the model mesh mask - call ESMF_MeshSet(model_mesh, elementMask=model_mask, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - - end if - - !------------------------------------- - ! Non single-column mode - !------------------------------------- - - if (.not. scol_mode) then - - ! allocate xv and read it in - allocate(xv(nv,ni,nj)) - rcode = pio_inq_varid(pioid, 'xv', varid) - call pio_check_err(rcode, 'pio_inq_varid for xv in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, xv) - call pio_check_err(rcode, 'pio_get_var for xv in file '//trim(filename)) - - ! allocate yv and read it in - allocate(yv(nv,ni,nj)) - rcode = pio_inq_varid(pioid, 'yv', varid) - call pio_check_err(rcode, 'pio_inq_varid for yv in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, yv) - call pio_check_err(rcode, 'pio_get_var for yv in file '//trim(filename)) - - ! create grid from corner vertices - maxIndex(1) = ni ! number of lons - maxIndex(2) = nj ! number of lats - mincornerCoord(1) = xv(1,1,1) ! min lon - mincornerCoord(2) = yv(1,1,1) ! min lat - maxcornerCoord(1) = xv(3,ni,nj) ! max lon - maxcornerCoord(2) = yv(3,ni,nj) ! max lat - - ! create the model grid - lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & - mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & - staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) + read(cvalue,*) model_mask(1) + call NUOPC_CompAttributeGet(gcomp, name='scol_lndfrac', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! create the mesh from the grid - model_mesh = ESMF_MeshCreate(lgrid, rc=rc) + read(cvalue,*) model_frac(1) + else if (compname == 'OCN' .or. compname == 'ICE') then + call NUOPC_CompAttributeGet(gcomp, name='scol_ocnmask', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! For the ATM component - the fractions and masks are always 1 - don't read them - ! in or reset the mesh - if (compname /= 'ATM') then - ! allocate model_mask and read it in - allocate(model_mask(ni*nj)) - rcode = pio_inq_varid(pioid, 'mask', varid) - call pio_check_err(rcode, 'pio_inq_varid for mask in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, model_mask) - call pio_check_err(rcode, 'pio_get_var for mask in file '//trim(filename)) - - ! allocate model_frac and read it in - allocate(model_frac(ni*nj)) - rcode = pio_inq_varid(pioid, 'frac', varid) - call pio_check_err(rcode, 'pio_inq_varid for frac in file '//trim(filename)) - rcode = pio_get_var(pioid, varid, model_frac) - call pio_check_err(rcode, 'pio_get_var for frac in file '//trim(filename)) - - ! reset the model mesh mask if not an atmosphere component - call ESMF_MeshSet(model_mesh, elementMask=mask, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - + read(cvalue,*) model_mask(1) + call NUOPC_CompAttributeGet(gcomp, name='scol_ocnfrac', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) model_frac(1) + else + call shr_sys_abort('ERROR: currently component '//trim(compname)//' is not supported for single column') end if - !------------------------------------- - ! close domain file and write diagnostic output - !------------------------------------- - - call pio_seterrorhandling(pioid, PIO_INTERNAL_ERROR) - call pio_closefile(pioid) - - call ESMF_MeshGet(model_mesh, numOwnedElements=numOwnedElements, spatialDim=spatialDim, rc=rc) + ! Use center and come up with arbitrary area delta lon and lat = .1 degree + maxIndex(1) = 1 ! number of lons + maxIndex(2) = 1 ! number of lats + mincornerCoord(1) = scol_lon - .1_r8 ! min lon + mincornerCoord(2) = scol_lat - .1_r8 ! min lat + maxcornerCoord(1) = scol_lon + .1_r8 ! max lon + maxcornerCoord(2) = scol_lat + .1_r8 ! max lat + + ! create the model grid + lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & + mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & + staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(ownedElemCoords(spatialDim*numOwnedElements)) ! this is a pointer and must be deallocated - call ESMF_MeshGet(model_mesh, ownedElemCoords=ownedElemCoords) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(lons(numOwnedElements)) - allocate(lats(numOwnedElements)) - do n = 1, numOwnedElements - lons(n) = ownedElemCoords(2*n-1) - lats(n) = ownedElemCoords(2*n) - end do - if (my_task == master_task) then - write(logunit,*)' Mesh created from file ',trim(filename) - write(logunit,*)' mesh element lons = ',lons(:) - write(logunit,*)' mesh element lats = ',lats(:) - end if - deallocate(ownedElemCoords) - - contains - subroutine pio_check_err(ierror, description) - integer , intent(in) :: ierror - character(*), intent(in) :: description - if (ierror /= PIO_NOERR) then - write (*,'(6a)') 'ERROR ', trim(description) - call shr_sys_abort() - endif - end subroutine pio_check_err + ! create the mesh from the grid + model_mesh = ESMF_MeshCreate(lgrid, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - end subroutine dshr_mesh_create + end subroutine dshr_mesh_create_scol !=============================================================================== subroutine dshr_set_runclock(gcomp, rc) @@ -1535,43 +1298,6 @@ subroutine dshr_orbital_update(clock, logunit, mastertask, eccen, obliqr, lambm end subroutine dshr_orbital_update - !=============================================================================== - real(R8) function getNextRadCDay_i8( ymd, tod, stepno, dtime, iradsw, calendar ) - - ! Return the calendar day of the next radiation time-step. - ! General Usage: nextswday = getNextRadCDay(curr_date) - - ! input/output variables - integer , intent(in) :: ymd - integer , intent(in) :: tod - integer(I8), intent(in) :: stepno - integer , intent(in) :: dtime - integer , intent(in) :: iradsw - character(*),intent(in) :: calendar - - ! local variables - real(R8) :: nextsw_cday - real(R8) :: julday - integer :: liradsw - character(*),parameter :: subName = '(getNextRadCDay) ' - !------------------------------------------------------------------------------- - - liradsw = iradsw - if (liradsw < 0) liradsw = nint((-liradsw *3600._r8)/dtime) - call shr_cal_date2julian(ymd,tod,julday,calendar) - if (liradsw > 1) then - if (mod(stepno+1,liradsw) == 0 .and. stepno > 0) then - nextsw_cday = julday + 2*dtime/shr_const_cday - else - nextsw_cday = -1._r8 - end if - else - nextsw_cday = julday + dtime/shr_const_cday - end if - getNextRadCDay_i8 = nextsw_cday - - end function getNextRadCDay_i8 - !=============================================================================== subroutine dshr_set_modelmask(mesh_dst, meshfile_mask, compname, mask_dst, frac_dst, rc) @@ -1652,7 +1378,7 @@ subroutine dshr_set_modelmask(mesh_dst, meshfile_mask, compname, mask_dst, frac_ termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=checkflag, zeroregion=ESMF_REGION_TOTAL, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - ! now determine mask_dst and frac_dst + ! now determine mask_dst and frac_dst call ESMF_MeshGet(mesh_dst, spatialDim=spatialDim, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldGet(field_dst, farrayptr=dataptr1d, rc=rc) @@ -1687,7 +1413,7 @@ subroutine dshr_set_modelmask(mesh_dst, meshfile_mask, compname, mask_dst, frac_ ! deallocate memory call ESMF_RouteHandleDestroy(rhandle, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldDestroy(field_mask, rc=rc) + call ESMF_FieldDestroy(field_mask, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldDestroy(field_dst, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -1723,7 +1449,8 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) logical :: pio_rearr_comm_enable_hs_io2comp logical :: pio_rearr_comm_enable_isend_io2comp integer :: pio_rearr_comm_max_pend_req_io2comp - logical :: isPresent, isSet, ret + logical :: isPresent, isSet + integer :: ret character(len=CL) :: cvalue character(len=CS) :: cname character(len=CL) :: logmsg @@ -1742,7 +1469,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) petCount=petCount, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! query component specific PIO attributes + ! query component specific PIO attributes ! pio_netcdf_format call NUOPC_CompAttributeGet(gcomp, name='pio_netcdf_format', value=cvalue, & isPresent=isPresent, isSet=isSet, rc=rc) @@ -1778,9 +1505,9 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) if (isPresent .and. isSet) then cvalue = ESMF_UtilStringUpperCase(cvalue) if (trim(cvalue) .eq. 'NETCDF') then - sdat%io_type = PIO_IOTYPE_NETCDF + sdat%io_type = PIO_IOTYPE_NETCDF else if (trim(cvalue) .eq. 'PNETCDF') then - sdat%io_type = PIO_IOTYPE_PNETCDF + sdat%io_type = PIO_IOTYPE_PNETCDF else if (trim(cvalue) .eq. 'NETCDF4C') then sdat%io_type = PIO_IOTYPE_NETCDF4C else if (trim(cvalue) .eq. 'NETCDF4P') then @@ -1811,7 +1538,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) endif pio_root = min(pio_root, petCount-1) else - pio_root = 1 + pio_root = 1 end if if (my_task == master_task) write(logunit,*) trim(subname)//' : pio_root = ', & pio_root @@ -1956,8 +1683,8 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) call pio_init(my_task, mpicom, pio_numiotasks, 0, pio_stride, & pio_rearranger, sdat%pio_subsystem, base=pio_root) - ! query shared PIO rearranger attributes - ! pio_rearr_comm_type + ! query shared PIO rearranger attributes + ! pio_rearr_comm_type call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_type', value=cvalue, & isPresent=isPresent, isSet=isSet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -1979,7 +1706,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) pio_rearr_comm_type = PIO_REARR_COMM_P2P end if if (my_task == master_task) write(logunit,*) trim(subname)// & - ' : pio_rearr_comm_type = ', trim(cvalue), pio_rearr_comm_type + ' : pio_rearr_comm_type = ', trim(cvalue), pio_rearr_comm_type ! pio_rearr_comm_fcd call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_fcd', value=cvalue, & @@ -2030,7 +1757,7 @@ subroutine dshr_pio_init(gcomp, sdat, logunit, rc) else pio_rearr_comm_enable_isend_comp2io = .false. end if - + ! pio_rearr_comm_max_pend_req_comp2io call NUOPC_CompAttributeGet(gcomp, name='pio_rearr_comm_max_pend_req_comp2io', & value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) diff --git a/dwav/CMakeLists.txt b/dwav/CMakeLists.txt index 97fccbd52..4dcee6175 100644 --- a/dwav/CMakeLists.txt +++ b/dwav/CMakeLists.txt @@ -15,8 +15,9 @@ add_library(dwav ${SRCFILES}) add_dependencies(dwav dshr streams) target_include_directories (dwav PRIVATE ${ESMF_F90COMPILEPATHS}) -target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dshr") +target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../dshr") target_include_directories (dwav PRIVATE "${CMAKE_SOURCE_DIR}") -target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/share") -target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/streams") +target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../share") +target_include_directories (dwav PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../streams") target_include_directories (dwav PRIVATE "${PIO_Fortran_INCLUDE_DIR}") +target_include_directories (dwav PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) diff --git a/dwav/cime_config/buildnml b/dwav/cime_config/buildnml index 5f9f508c8..6802f2b27 100755 --- a/dwav/cime_config/buildnml +++ b/dwav/cime_config/buildnml @@ -61,8 +61,17 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['dwav_mode'] = dwav_mode # do not allow single column mode for dwav - expect(not case.get_value('PTS_MODE'), - "for, DWAV single column mode is not allowed") + if case.get_value('PTS_LON'): + scol_lon = float(case.get_value('PTS_LON')) + else: + scol_lon = -999. + if case.get_value('PTS_LAT'): + scol_lat = float(case.get_value('PTS_LAT')) + else: + scol_lat = -999. + if (scol_lon > -999. and scol_lat > 999.): + expect(False, + "single column mode for DWAV is not currently allowed") # Initialize nmlgen nmlgen.init_defaults(infile, config) diff --git a/dwav/cime_config/namelist_definition_dwav.xml b/dwav/cime_config/namelist_definition_dwav.xml index 6707ed013..ce9cc85e4 100644 --- a/dwav/cime_config/namelist_definition_dwav.xml +++ b/dwav/cime_config/namelist_definition_dwav.xml @@ -45,7 +45,6 @@ $WAV_DOMAIN_MESH - null @@ -62,20 +61,6 @@ - - char - streams - abs - dwav_nml - - file specifying model mesh - - - null - $WAV_DOMAIN_PATH/$WAV_DOMAIN_FILE - - - integer streams diff --git a/dwav/wav_comp_nuopc.F90 b/dwav/wav_comp_nuopc.F90 index 2159a8c16..8dc4978c1 100644 --- a/dwav/wav_comp_nuopc.F90 +++ b/dwav/wav_comp_nuopc.F90 @@ -17,7 +17,7 @@ module wav_comp_nuopc use NUOPC_Model , only : model_label_Advance => label_Advance use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet + use NUOPC_Model , only : NUOPC_ModelGet, SetVM use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort use shr_cal_mod , only : shr_cal_ymd2date @@ -35,7 +35,7 @@ module wav_comp_nuopc private ! except public :: SetServices - + public :: SetVM private :: InitializeAdvertise private :: InitializeRealize private :: ModelAdvance @@ -69,7 +69,6 @@ module wav_comp_nuopc character(CL) :: dataMode = nullstr ! flags physics options wrt input data character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from - character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from character(CL) :: restfilm = nullstr ! model restart file namelist integer :: nx_global integer :: ny_global @@ -160,7 +159,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) character(*) ,parameter :: F02 = "('(wav_comp_nuopc) ',a,l6)" !------------------------------------------------------------------------------- - namelist / dwav_nml / datamode, model_meshfile, model_maskfile, model_createmesh_fromfile, & + namelist / dwav_nml / datamode, model_meshfile, model_maskfile, & restfilm, nx_global, ny_global rc = ESMF_SUCCESS @@ -191,44 +190,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! write namelist input to standard out write(logunit,F00)' datamode = ',trim(datamode) - if (model_createmesh_fromfile /= nullstr) then - write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile) - else - write(logunit,F00)' model_meshfile = ',trim(model_meshfile) - write(logunit,F00)' model_maskfile = ',trim(model_maskfile) - end if + write(logunit,F00)' model_meshfile = ',trim(model_meshfile) + write(logunit,F00)' model_maskfile = ',trim(model_maskfile) write(logunit,F01)' nx_global = ',nx_global write(logunit,F01)' ny_global = ',ny_global write(logunit,F00)' restfilm = ',trim(restfilm) - - ! check that files exists - if (model_createmesh_fromfile /= nullstr) then - inquire(file=trim(model_createmesh_fromfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_createmesh_fromfile '//& - trim(model_createmesh_fromfile)//' does not exist') - end if - else - inquire(file=trim(model_meshfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_meshfile '//trim(model_meshfile)//' does not exist') - end if - inquire(file=trim(model_maskfile), exist=exists) - if (.not.exists) then - write(logunit, *)' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist' - call shr_sys_abort(trim(subname)//' ERROR: model_maskfile '//trim(model_maskfile)//' does not exist') - end if - end if endif ! broadcast namelist input call shr_mpi_bcast(datamode , mpicom, 'datamode') call shr_mpi_bcast(model_meshfile , mpicom, 'model_meshfile') call shr_mpi_bcast(model_maskfile , mpicom, 'model_maskfile') - call shr_mpi_bcast(model_createmesh_fromfile , mpicom, 'model_createmesh_fromfile') call shr_mpi_bcast(nx_global , mpicom, 'nx_global') call shr_mpi_bcast(ny_global , mpicom, 'ny_global') call shr_mpi_bcast(restfilm , mpicom, 'restfilm') @@ -268,8 +240,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Initialize sdat - create the model domain mesh and intialize the sdat clock call ESMF_TraceRegionEnter('dwav_strdata_init') call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'WAV', nx_global, ny_global, & - model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, & - model_mask, model_frac, restart_read, rc=rc) + model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Initialize stream data type if not aqua planet diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index d24e8f93c..62a87f226 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -5,42 +5,27 @@ set (GenF90_SRCS shr_infnan_mod.F90 shr_assert_mod.F90) add_library(cdeps_share ${GenF90_SRCS} - glc_elevclass_mod.F90 - shr_timer_mod.F90 - shr_cal_mod.F90 + glc_elevclass_mod.F90 + shr_timer_mod.F90 + shr_cal_mod.F90 shr_kind_mod.F90 shr_sys_mod.F90 shr_abort_mod.F90 - shr_const_mod.F90 - shr_orb_mod.F90 - shr_mpi_mod.F90 - shr_log_mod.F90 - shr_strconvert_mod.F90 - shr_precip_mod.F90 - shr_string_mod.F90) + shr_const_mod.F90 + shr_orb_mod.F90 + shr_mpi_mod.F90 + shr_log_mod.F90 + shr_strconvert_mod.F90 + shr_precip_mod.F90 + shr_string_mod.F90) target_include_directories (cdeps_share PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${ESMF_F90COMPILEPATHS} ${PIO_Fortran_INCLUDE_DIRS}) install(TARGETS cdeps_share LIBRARY DESTINATION lib) - #===== genf90 ===== -if (DEFINED GENF90_PATH) - add_custom_target(genf90 - DEPENDS ${GENF90_PATH}/genf90.pl) -else () - ExternalProject_Add (genf90 - PREFIX ${CMAKE_CURRENT_BINARY_DIR}/genf90 - GIT_REPOSITORY https://github.com/PARALLELIO/genf90 - GIT_TAG genf90_200608 - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "") - ExternalProject_Get_Property (genf90 SOURCE_DIR) - set (GENF90_PATH ${SOURCE_DIR}) - unset (SOURCE_DIR) -endif () +set(GENF90_PATH ${CMAKE_CURRENT_SOURCE_DIR}/genf90) +add_custom_target(genf90 DEPENDS ${GENF90_PATH}/genf90.pl) add_dependencies (cdeps_share genf90) #===== Fortran Source Generation with GenF90 ===== diff --git a/streams/CMakeLists.txt b/streams/CMakeLists.txt index ee9a924e3..67e2eb429 100644 --- a/streams/CMakeLists.txt +++ b/streams/CMakeLists.txt @@ -1,7 +1,7 @@ set(SRCFILES dshr_methods_mod.F90 - dshr_strdata_mod.F90 - dshr_stream_mod.F90 - dshr_tinterp_mod.F90) + dshr_strdata_mod.F90 + dshr_stream_mod.F90 + dshr_tinterp_mod.F90) set(MODFILES ${SRCFILES}) @@ -23,13 +23,14 @@ if(BLD_STANDALONE) add_dependencies(streams cdeps_share) endif() -target_include_directories (streams PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/fox/include) +target_include_directories (streams PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../fox/include) target_include_directories (streams PRIVATE ${ESMF_F90COMPILEPATHS}) target_include_directories (streams PRIVATE ${PIO_Fortran_INCLUDE_DIR}) -target_include_directories (streams PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/share) +target_include_directories (streams PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../share) install(TARGETS streams - LIBRARY DESTINATION lib) + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) foreach(MOD ${MODFILES}) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${MOD}" DESTINATION include) endforeach() diff --git a/streams/dshr_strdata_mod.F90 b/streams/dshr_strdata_mod.F90 index 653524ea5..c735a896a 100644 --- a/streams/dshr_strdata_mod.F90 +++ b/streams/dshr_strdata_mod.F90 @@ -148,7 +148,11 @@ module dshr_strdata_mod integer function shr_strdata_get_stream_count(sdat) type(shr_strdata_type) , intent(in) :: sdat - shr_strdata_get_stream_count = size(sdat%stream) + if(associated(sdat%stream)) then + shr_strdata_get_stream_count = size(sdat%stream) + else + shr_strdata_get_stream_count = 0 + endif end function shr_strdata_get_stream_count !=============================================================================== @@ -945,7 +949,6 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc) ! --------------------------------------------------------- do ns = 1,nstreams - if (trim(sdat%stream(ns)%tinterpalgo) == 'coszen') then ! Determine stream lower bound index From 31711d4eb2ee758f39c5ce54d0e4bcee943b0d34 Mon Sep 17 00:00:00 2001 From: "Bin.Li" Date: Fri, 30 Apr 2021 13:19:57 +0000 Subject: [PATCH 10/10] Remove commented code. --- datm/datm_datamode_cfsr_mod.F90 | 22 ++++++++-------------- datm/datm_datamode_gefs_mod.F90 | 22 ++++++++-------------- 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/datm/datm_datamode_cfsr_mod.F90 b/datm/datm_datamode_cfsr_mod.F90 index 21e591b99..24b5b8dda 100644 --- a/datm/datm_datamode_cfsr_mod.F90 +++ b/datm/datm_datamode_cfsr_mod.F90 @@ -1,6 +1,6 @@ module datm_datamode_cfsr_mod - use ESMF + use ESMF , only : ESMF_State, ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort @@ -21,7 +21,6 @@ module datm_datamode_cfsr_mod public :: datm_datamode_cfsr_advance public :: datm_datamode_cfsr_restart_write public :: datm_datamode_cfsr_restart_read -! private :: datm_eSat ! determine saturation vapor pressure ! export state data real(r8), pointer :: Sa_z(:) => null() @@ -32,19 +31,19 @@ module datm_datamode_cfsr_mod real(r8), pointer :: Sa_pbot(:) => null() real(r8), pointer :: Sa_u10m(:) => null() real(r8), pointer :: Sa_v10m(:) => null() - real(r8), pointer :: Sa_t2m(:) => null() - real(r8), pointer :: Sa_q2m(:) => null() + real(r8), pointer :: Sa_t2m(:) => null() + real(r8), pointer :: Sa_q2m(:) => null() real(r8), pointer :: Sa_pslv(:) => null() real(r8), pointer :: Faxa_lwdn(:) => null() real(r8), pointer :: Faxa_rain(:) => null() - real(r8), pointer :: Faxa_snow(:) => null() + real(r8), pointer :: Faxa_snow(:) => null() real(r8), pointer :: Faxa_swndr(:) => null() real(r8), pointer :: Faxa_swndf(:) => null() real(r8), pointer :: Faxa_swvdr(:) => null() real(r8), pointer :: Faxa_swvdf(:) => null() ! stream data - real(r8), pointer :: strm_mask(:) => null() + real(r8), pointer :: strm_mask(:) => null() real(r8) :: tbotmax ! units detector real(r8) :: maskmax ! units detector @@ -86,11 +85,11 @@ subroutine datm_datamode_cfsr_advertise(exportState, fldsexport, & call dshr_fldList_add(fldsExport, 'Sa_shum' ) call dshr_fldList_add(fldsExport, 'Sa_u10m' ) call dshr_fldList_add(fldsExport, 'Sa_v10m' ) - call dshr_fldList_add(fldsExport, 'Sa_t2m' ) - call dshr_fldList_add(fldsExport, 'Sa_q2m' ) + call dshr_fldList_add(fldsExport, 'Sa_t2m' ) + call dshr_fldList_add(fldsExport, 'Sa_q2m' ) call dshr_fldList_add(fldsExport, 'Sa_pslv' ) call dshr_fldList_add(fldsExport, 'Faxa_rain' ) - call dshr_fldList_add(fldsExport, 'Faxa_snow' ) + call dshr_fldList_add(fldsExport, 'Faxa_snow' ) call dshr_fldList_add(fldsExport, 'Faxa_swndr' ) call dshr_fldList_add(fldsExport, 'Faxa_swvdr' ) call dshr_fldList_add(fldsExport, 'Faxa_swndf' ) @@ -184,8 +183,6 @@ subroutine datm_datamode_cfsr_advance(exportstate, masterproc, logunit, mpicom, integer :: lsize ! size of attr vect real(r8) :: rtmp real(r8) :: tbot, pbot -! real(r8) :: vp - real(r8) :: e, qsat character(len=*), parameter :: subname='(datm_datamode_cfsr_advance): ' !------------------------------------------------------------------------------- @@ -209,9 +206,6 @@ subroutine datm_datamode_cfsr_advance(exportstate, masterproc, logunit, mpicom, end if do n = 1, lsize - !--- bottom layer height --- -! Sa_z(n) = 10.0_r8 - !--- temperature --- if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz ! Limit very cold forcing to 180K diff --git a/datm/datm_datamode_gefs_mod.F90 b/datm/datm_datamode_gefs_mod.F90 index c31146f9f..0d7274c04 100644 --- a/datm/datm_datamode_gefs_mod.F90 +++ b/datm/datm_datamode_gefs_mod.F90 @@ -1,6 +1,6 @@ module datm_datamode_gefs_mod - use ESMF + use ESMF , only : ESMF_State, ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO use NUOPC , only : NUOPC_Advertise use shr_kind_mod , only : r8=>shr_kind_r8, i8=>shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort @@ -21,7 +21,6 @@ module datm_datamode_gefs_mod public :: datm_datamode_gefs_advance public :: datm_datamode_gefs_restart_write public :: datm_datamode_gefs_restart_read -! private :: datm_eSat ! determine saturation vapor pressure ! export state data real(r8), pointer :: Sa_z(:) => null() @@ -32,19 +31,19 @@ module datm_datamode_gefs_mod real(r8), pointer :: Sa_pbot(:) => null() real(r8), pointer :: Sa_u10m(:) => null() real(r8), pointer :: Sa_v10m(:) => null() - real(r8), pointer :: Sa_t2m(:) => null() - real(r8), pointer :: Sa_q2m(:) => null() + real(r8), pointer :: Sa_t2m(:) => null() + real(r8), pointer :: Sa_q2m(:) => null() real(r8), pointer :: Sa_pslv(:) => null() real(r8), pointer :: Faxa_lwdn(:) => null() real(r8), pointer :: Faxa_rain(:) => null() - real(r8), pointer :: Faxa_snow(:) => null() + real(r8), pointer :: Faxa_snow(:) => null() real(r8), pointer :: Faxa_swndr(:) => null() real(r8), pointer :: Faxa_swndf(:) => null() real(r8), pointer :: Faxa_swvdr(:) => null() real(r8), pointer :: Faxa_swvdf(:) => null() ! stream data - real(r8), pointer :: strm_mask(:) => null() + real(r8), pointer :: strm_mask(:) => null() real(r8) :: tbotmax ! units detector real(r8) :: maskmax ! units detector @@ -86,11 +85,11 @@ subroutine datm_datamode_gefs_advertise(exportState, fldsexport, & call dshr_fldList_add(fldsExport, 'Sa_shum' ) call dshr_fldList_add(fldsExport, 'Sa_u10m' ) call dshr_fldList_add(fldsExport, 'Sa_v10m' ) - call dshr_fldList_add(fldsExport, 'Sa_t2m' ) - call dshr_fldList_add(fldsExport, 'Sa_q2m' ) + call dshr_fldList_add(fldsExport, 'Sa_t2m' ) + call dshr_fldList_add(fldsExport, 'Sa_q2m' ) call dshr_fldList_add(fldsExport, 'Sa_pslv' ) call dshr_fldList_add(fldsExport, 'Faxa_rain' ) - call dshr_fldList_add(fldsExport, 'Faxa_snow' ) + call dshr_fldList_add(fldsExport, 'Faxa_snow' ) call dshr_fldList_add(fldsExport, 'Faxa_swndr' ) call dshr_fldList_add(fldsExport, 'Faxa_swvdr' ) call dshr_fldList_add(fldsExport, 'Faxa_swndf' ) @@ -184,8 +183,6 @@ subroutine datm_datamode_gefs_advance(exportstate, masterproc, logunit, mpicom, integer :: lsize ! size of attr vect real(r8) :: rtmp real(r8) :: tbot, pbot -! real(r8) :: vp - real(r8) :: e, qsat character(len=*), parameter :: subname='(datm_datamode_gefs_advance): ' !------------------------------------------------------------------------------- @@ -209,9 +206,6 @@ subroutine datm_datamode_gefs_advance(exportstate, masterproc, logunit, mpicom, end if do n = 1, lsize - !--- bottom layer height --- -! Sa_z(n) = 10.0_r8 - !--- temperature --- if (tbotmax < 50.0_r8) Sa_tbot(n) = Sa_tbot(n) + tkFrz ! Limit very cold forcing to 180K