diff --git a/doc/source/data_models/data-atm.rst b/doc/source/data_models/data-atm.rst index c82631e8383..053d01e854b 100644 --- a/doc/source/data_models/data-atm.rst +++ b/doc/source/data_models/data-atm.rst @@ -4,9 +4,9 @@ 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. -In the case of CESM, these would be: CLM (I compset), POP2 (C compset), and POP2/CICE (G compset). +In the case of CESM, these would be: CLM (I compset), POP2 (C compset), and POP2/CICE (G compset). As a result, DATM variable settings are specific to the compset that will be targeted. -As examples, CORE2_NYF (CORE2 normal year forcing) is the DATM mode used in C and G compsets. +As examples, CORE2_NYF (CORE2 normal year forcing) is the DATM mode used in C and G compsets. CLM_QIAN, CLMCRUNCEP, CLMGSWP3 and CLM1PT are DATM modes using observational data for forcing CLM in I compsets. .. _datm-xml-vars: @@ -14,7 +14,7 @@ CLM_QIAN, CLMCRUNCEP, CLMGSWP3 and CLM1PT are DATM modes using observational dat ------------------ xml variables ------------------ -The following are ``$CASEROOT`` xml variables that CIME supports for DATM. +The following are ``$CASEROOT`` xml variables that CIME supports for DATM. These variables are defined in ``$CIMEROOT/src/components/data_comps/datm/cime_config/config_component.xml``. These variables will appear in ``env_run.xml`` and the resulting values are compset dependent. @@ -24,20 +24,26 @@ These variables will appear in ``env_run.xml`` and the resulting values are comp :header: "xml variable", "description" :widths: 20, 80 - "DATM_MODE", "Mode for atmospheric component" - "", "Valid values are: CORE2_NYF,CORE2_IAF,CLM_QIAN,CLM_QIAN_WISO,CLM1PT,CLMCRUNCEP," - "", "CLMCRUNCEP_V5,CLMGSWP3,WW3,CPLHISTForcing" - "DATM_PRESAERO", "Prescribed aerosol forcing, if any" - "DATM_TOPO", "Surface topography" - "DATM_CO2_TSERIES", "CO2 time series type" - "DATM_CPLHIST_CASE", "Coupler history data mode case name" - "DATM_CPLHIST_DIR", "Coupler history data mode directory containing coupler history data" - "DATM_CPLHIST_YR_ALIGN", "Coupler history data model simulation year corresponding to data starting year" - "DATM_CPLHIST_YR_START", "Coupler history data model starting year to loop data over" - "DATM_CPLHIST_YR_END", "Coupler history data model ending year to loop data over" - "DATM_CLMNCEP_YR_ALIGN", "I compsets only - simulation year corresponding to data starting year" - "DATM_CPLHIST_YR_START", "I compsets only - data model starting year to loop data over" - "DATM_CPLHIST_YR_END", "I compsets only - data model ending year to loop data over" + "DATM_MODE", "Mode for atmospheric component" + "", "Valid values are: CORE2_NYF,CORE2_IAF,CLM_QIAN,CLM_QIAN_WISO,CLM1PT,CLMCRUNCEP," + "", "CLMCRUNCEP_V5,CLMGSWP3,WW3,CPLHIST" + + "DATM_PRESAERO", "Optional prescribed aerosol forcing" + "DATM_TOPO", "Optional Surface topography" + "DATM_CO2_TSERIES", "Optional CO2 time series type" + + "DATM_CPLHIST_DOMAIN_FILE", "Coupler history forcing data mode - full pathname of model domain file " + "DATM_CPLHIST_CASE", "Coupler history forcing data mode - case name" + "DATM_CPLHIST_DIR", "Coupler history forcing data mode - directory containing coupler history data" + "DATM_CPLHIST_YR_ALIGN", "Coupler history forcing data mode - simulation year corresponding to DATM_CPLHIST_YR_START" + "DATM_CPLHIST_YR_START", "Coupler history forcing data mode - starting year to loop data over" + "DATM_CPLHIST_YR_END", "Coupler history forcing data mode - ending year to loop data over" + + "DATM_CLMNCEP_YR_ALIGN", "I compsets only - simulation year corresponding to data starting year" + "DATM_CLMNCEP_YR_START", "I compsets only - data model starting year to loop data over" + "DATM_CLMNCEP_YR_END", "I compsets only - data model ending year to loop data over" + +.. note:: If ``DATM_MODE`` is set to ``CPLHIST``, it is normally assumed that the model domain will be identical to **all** of the stream domains. To ensure this, the xml variables ``ATM_DOMAIN_PATH`` and ``ATM_DOMAIN_FILE`` are ignored and a valid setting **must be given** for ``DATM_CPLHIST_DOMAIN_FILE``. If ``DATM_CPLHIST_DOMAIN_FILE`` is set to ``null``, then the datm component domain information is read in from the first coupler history file in the target stream and it is assumed that the first coupler stream file that is pointed to contains the domain information for that stream. This is the default that should be used for this mode. Alternatively, ``DATM_CPLHIST_DOMAIN_FILE`` can be set to ``$ATM_DOMAIN_PATH/$ATM_DOMAIN_FILE`` in a non-default configuration. .. _datm-datamodes: @@ -45,21 +51,20 @@ These variables will appear in ``env_run.xml`` and the resulting values are comp datamode values -------------------- -The xml variable ``DATM_MODE`` sets the streams that are associated with DATM and also sets the namelist variable ``datamode`` that specifies what additional operations need to be done by DATM on the streams before returning to the driver. -One of the variables in ``shr_strdata_nml`` is ``datamode``, whose value is a character string. Each data model has a unique set of ``datamode`` values that it supports. -The valid values for ``datamode`` are set in the file ``namelist_definition_datm.xml`` using the xml variable ``DATM_MODE`` in the ``config_component.xml`` file for DATM. -CIME will generate a value ``datamode`` that is compset dependent. +The xml variable ``DATM_MODE`` is used to set the streams that are associated with DATM and also to set the namelist variable ``datamode`` that specifies what additional operations need to be done by DATM on the streams before returning to the driver. +One of the variables in ``shr_strdata_nml`` is ``datamode``, whose value is a character string. Each data model has a unique set of ``datamode`` values that it supports. +The valid values for ``datamode`` are set in the file ``namelist_definition_datm.xml`` using the xml variable ``DATM_MODE`` in the ``config_component.xml`` file for DATM. +CIME will generate a value ``datamode`` that is compset dependent. -The following are the supported DATM datamode values and their relationship to the ``$DATM_MODE`` xml variable value. +The following are the supported DATM ``datamode`` values and their relationship to the ``$DATM_MODE`` xml variable value. .. csv-table:: "Valid values for datamode namelist variable" :header: "datamode variable", "description" :widths: 20, 80 "NULL", "This mode turns off the data model as a provider of data to the coupler. The ``atm_present`` flag will be set to ``false`` and the coupler assumes no exchange of data to or from the data model." - "COPYALL", "The default science mode of the data model is the COPYALL mode. This 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. " - "CPLHIST","Uilize user-generated coupler history data to spin up prognostic component. Works exactly like COPYALL." - "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." + "COPYALL", "The default science mode of the data model is the COPYALL mode. This 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. " + "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 CIME coupling infrastructure and data models to do active-land-only simulations." "CORE2_NYF", "Coordinated Ocean-ice Reference Experiments (CORE) Version 2 Normal Year Forcing." "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 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." @@ -102,9 +107,9 @@ The following tabe describes the valid values of ``DATM_MODE``, and how it relat "CLM1PT", "single point tower site atm input data" "","streams: CLM1PT.$ATM_GRID" "","datamode: CLMNCEP" - "CPLHISTForcing","user generated forcing data to spinup for I and G compsets" - "","streams: CPLHISTForcingForOcnIce.Solar,CPLHISTForcingForOcnIce.nonSolarFlux," - "","CPLHISTForcingForOcnIce.State3hr,CPLHISTForcingForOcnIce.State1hr" + "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," + "","CPLHISTForcing.State3hr,CPLHISTForcing.State1hr" "","datamode: CPLHIST" "WW3","WW3 wave watch data from a short period of hi WW3 wave watch data from a short period of hi temporal frequency COREv2 data" "","streams: WW3" @@ -114,7 +119,7 @@ The following tabe describes the valid values of ``DATM_MODE``, and how it relat Namelists -------------- -The DATM namelist file is ``datm_in`` (or ``datm_in_NNN`` for multiple instances). DATM namelists can be separated into two groups: *stream-independent* namelist variables that are specific to the DATM model and *stream-specific* namelist variables whose names are common to all the data models. +The DATM namelist file is ``datm_in`` (or ``datm_in_NNN`` for multiple instances). DATM namelists can be separated into two groups: *stream-independent* namelist variables that are specific to the DATM model and *stream-specific* namelist variables whose names are common to all the data models. Stream dependent input is in the namelist group ``"shr_strdata_nml`` which is discussed in :ref:`input streams ` and is the same for all data models. @@ -126,17 +131,17 @@ The stream-independent group is ``datm_nml`` and the DATM stream-independent nam datm_nml vars description ===================== ============================================================================================= decomp decomposition strategy (1d, root) - + 1d => vector decomposition, root => run on master task -restfilm master restart filename -restfils stream restart filename +restfilm master restart filename +restfils stream restart filename force_prognostic_true TRUE => force prognostic behavior bias_correct if set, include bias correction streams in namelist anomaly_forcing if set, includ anomaly forcing streams in namelist -factorfn filename containing correction factors for use in CORE2 modes (CORE2_IAF and CORE2_NYF) -presaero if true, prescribed aerosols are sent from datm +factorfn filename containing correction factors for use in CORE2 modes (CORE2_IAF and CORE2_NYF) +presaero if true, prescribed aerosols are sent from datm iradsw frequency to update radiation in number of time steps (of hours if negative) -wiso_datm if true, turn on water isotopes +wiso_datm if true, turn on water isotopes ===================== ============================================================================================= .. _datm-mode-independent-streams: @@ -145,23 +150,23 @@ wiso_datm if true, turn on water isotopes Streams independent of DATM_MODE value ------------------------------------------ -In general, each ``DATM_MODE`` xml variable is identified with a unique set of streams. +In general, each ``DATM_MODE`` xml variable is identified with a unique set of streams. However, there are several streams in DATM that can accompany any ``DATM_MODE`` setting. Currently, these are streams associated with prescribed aerosols, co2 time series, topography, anomoly forcing and bias correction. These mode-independent streams are activated different, depending on the stream. - ``prescribed aerosol stream:`` - To add this stream, set ``$DATM_PRESAERO`` to a supported value other than ``none``. + To add this stream, set ``$DATM_PRESAERO`` to a supported value other than ``none``. - ``co2 time series stream``: To add this stream, set ``$DATM_CO2_TSERIES`` to a supported value other than ``none``. - + - ``topo stream``: To add this stream, set ``$DATM_TOPO`` to a supported value other than ``none``. - ``anomaly forcing stream:`` To add this stream, you need to add any of the following keywword/value pair to the end of ``user_nl_datm``: - :: + :: Anomaly.Forcing.Precip = Anomaly.Forcing.Temperature = @@ -174,7 +179,7 @@ These mode-independent streams are activated different, depending on the stream. - ``bias_correct stream:`` To add this stream, you need to add any of the following keywword/value pair to the end of ``user_nl_datm``: - :: + :: BC.QIAN.CMAP.Precip = BC.QIAN.GPCP.Precip = @@ -270,7 +275,3 @@ In general, the stream input file should translate the stream input variable nam "snowl_HDO", "Faxa_snowl_HDO" "shum_16O", "Sa_shum_16O" "shum_18O", "Sa_shum_18O" - - - - diff --git a/doc/source/data_models/data-lnd.rst b/doc/source/data_models/data-lnd.rst index 2bdee8b6fb1..a0d941e2856 100644 --- a/doc/source/data_models/data-lnd.rst +++ b/doc/source/data_models/data-lnd.rst @@ -3,9 +3,9 @@ Data Land (DLND) ================ -The land model is unique because it supports land data and snow data (*lnd and sno*) almost as if they were two separate components, but they are in fact running in one component model through one interface. -The lnd (land) data consist of fields sent to the atmosphere. -This set of data is used when running DLND with an active atmosphere. +The land model is unique because it supports land data and snow data (*lnd and sno*) almost as if they were two separate components, but they are in fact running in one component model through one interface. +The lnd (land) data consist of fields sent to the atmosphere. +This set of data is used when running DLND with an active atmosphere. In general this is not a mode that is used or supported. The sno (snow) data consist of fields sent to the glacier model. This set of data is used when running dlnd with an active glacier model (TG compsets). Both sets of data are assumed to be on the same grid. @@ -15,7 +15,7 @@ The sno (snow) data consist of fields sent to the glacier model. This set of dat xml variables --------------- -The following are xml variables that CIME supports for DLND. +The following are xml variables that CIME supports for DLND. These variables are defined in ``$CIMEROOT/src/components/data_comps/dlnd/cime_config/config_component.xml``. These variables will appear in ``env_run.xml`` and are used by the DLND ``cime_config/buildnml`` script to generate the DLND namelist file ``dlnd_in`` and the required associated stream files for the case. @@ -27,11 +27,15 @@ These variables will appear in ``env_run.xml`` and are used by the DLND ``cime_c "DLND_MODE", "Mode for data land component" "", "Valid values are: NULL, CPLHIST, GLC_CPLHIST" - "DLND_CPLHIST_CASE", "Coupler history data mode case name" - "DLND_CPLHIST_DIR", "Coupler history data mode directory containing coupler history data" - "DLND_CPLHIST_YR_ALIGN", "Coupler history data model simulation year corresponding to data starting year" - "DLND_CPLHIST_YR_START", "Coupler history data model starting year to loop data over" - "DLND_CPLHIST_YR_END", "Coupler history data model ending year to loop data over" + + "DLND_CPLHIST_DOMAIN_FILE", "Coupler history forcing data mode - full pathname of model domain file" + "DLND_CPLHIST_CASE", "Coupler history forcing data mode - case name" + "DLND_CPLHIST_DIR", "Coupler history forcing data mode - directory containing coupler history data" + "DLND_CPLHIST_YR_ALIGN", "Coupler history forcing data mode - simulation year corresponding to DLND_CPLHIST_YR_START" + "DLND_CPLHIST_YR_START", "Coupler history forcing data mode - starting year to loop data over" + "DLND_CPLHIST_YR_END", "Coupler history forcing data mode - ending year to loop data over" + +.. note:: If ``DLND_MODE`` is set to ``CPLHIST``, it is normally assumed that the model domain will be identical to **all** of the stream domains. To ensure this, the xml variables ``LND_DOMAIN_PATH`` and ``LND_DOMAIN_FILE`` are ignored and a valid setting **must be given** for ``DLND_CPLHIST_DOMAIN_FILE``. If ``DLND_CPLHIST_DOMAIN_FILE`` is set to ``null``, then the dlnd component domain information is read in from the first coupler history file in the target stream and it is assumed that the first coupler stream file that is pointed to contains the domain information for that stream. This is the default mode that should be used for this mode. Alternatively, ``DLND_CPLHIST_DOMAIN_FILE`` can be set to ``$LND_DOMAIN_PATH/$LND_DOMAIN_FILE`` in a non-default configuration. .. _dlnd-datamodes: @@ -40,11 +44,11 @@ datamode values -------------------- The xml variable ``DLND_MODE`` sets the streams that are associated with DLND and also sets the namelist variable ``datamode`` that specifies what additional operations need to be done by DLND on the streams before returning to the driver. -One of the variables in ``shr_strdata_nml`` is ``datamode``, whose value is a character string. Each data model has a unique set of ``datamode`` values that it supports. -The valid values for ``datamode`` are set in the file ``namelist_definition_dlnd.xml`` using the xml variable ``DLND_MODE`` in the ``config_component.xml`` file for DLND. -CIME will generate a value ``datamode`` that is compset dependent. +One of the variables in ``shr_strdata_nml`` is ``datamode``, whose value is a character string. Each data model has a unique set of ``datamode`` values that it supports. +The valid values for ``datamode`` are set in the file ``namelist_definition_dlnd.xml`` using the xml variable ``DLND_MODE`` in the ``config_component.xml`` file for DLND. +CIME will generate a value ``datamode`` that is compset dependent. -The following are the supported DATM datamode values and their relationship to the ``$DATM_MODE`` xml variable value. +The following are the supported DLND datamode values and their relationship to the ``$DLND_MODE`` xml variable value. .. csv-table:: "Valid values for datamode namelist variable" :header: "datamode variable", "description" @@ -66,7 +70,7 @@ The following tabe describes the valid values of ``DLND_MODE``, and how it relat "NULL", "null mode" "", "streams: none" "", "datamode: null" - "CPLHIST", "land forcing data (e.g. produced by CESM/CLM) from a previous model run is output in coupler history files and read in by the data land model." + "CPLHIST", "land forcing data (e.g. produced by CESM/CLM) from a previous model run is output in coupler history files and read in by the data land model." "", "streams: lnd.cplhist" "", "COPYALL" "GLC_CPLHIST", "glc coupling fields (e.g. produced by CESM/CLM) from a previous model run are read in from a coupler history file." @@ -79,9 +83,9 @@ Namelists The namelist file for DLND is ``dlnd_in`` (or ``dlnd_in_NNN`` for multiple instances). -As is the case for all data models, DLND namelists can be separated into two groups, stream-independent and stream-dependent. +As is the case for all data models, DLND namelists can be separated into two groups, stream-independent and stream-dependent. -The stream dependent group is :ref:`shr_strdata_nml`. +The stream dependent group is :ref:`shr_strdata_nml`. .. _dlnd-stream-independent-namelists: @@ -89,14 +93,14 @@ The stream-independent group is ``dlnd_nml`` and the DLND stream-independent nam ===================== ====================================================== decomp decomposition strategy (1d, root) - + 1d => vector decomposition, root => run on master task -restfilm master restart filename -restfils stream restart filename +restfilm master restart filename +restfils stream restart filename force_prognostic_true TRUE => force prognostic behavior ===================== ====================================================== - -To change the namelist settings in dlnd_in, edit the file user_nl_dlnd. + +To change the namelist settings in dlnd_in, edit the file user_nl_dlnd. .. _dlnd-mode-independent-streams: @@ -119,57 +123,30 @@ In general, the stream input file should translate the stream input variable nam :header: "dlnd_fld (avifld)", "driver_fld (avofld)" :widths: 30, 30 - "t", "Sl_t" - "tref", "Sl_tref" - "qref", "Sl_qref" - "avsdr", "Sl_avsdr" - "anidr", "Sl_anidr" - "avsdf", "Sl_avsdf" - "anidf", "Sl_anidf" - "snowh", "Sl_snowh" - "taux", "Fall_taux" - "tauy", "Fall_tauy" - "lat", "Fall_lat" - "sen", "Fall_sen" - "lwup", "Fall_lwup" - "evap", "Fall_evap" - "swnet", "Fall_swnet" - "lfrac", "Sl_landfrac" - "fv", "Sl_fv" - "ram1", "Sl_ram1" - "flddst1", "Fall_flxdst1" - "flxdst2", "Fall_flxdst2" - "flxdst3", "Fall_flxdst3" - "flxdst4", "Fall_flxdst4" - "tsrfNN", "Sl_tsrf" - "topoNN", "Sl_topo" - "qiceNN", "Flgl_qice" - -where NN = (01,02,...,``nflds_snow * glc_nec)``, and ``nflds_snow`` is the number of snow fields in each elevation class and ``glc_nec`` is the number of elevation classes. - - - - - - - - - - - - - - - - - - - - - - - - - - - + "t", "Sl_t" + "tref", "Sl_tref" + "qref", "Sl_qref" + "avsdr", "Sl_avsdr" + "anidr", "Sl_anidr" + "avsdf", "Sl_avsdf" + "anidf", "Sl_anidf" + "snowh", "Sl_snowh" + "taux", "Fall_taux" + "tauy", "Fall_tauy" + "lat", "Fall_lat" + "sen", "Fall_sen" + "lwup", "Fall_lwup" + "evap", "Fall_evap" + "swnet", "Fall_swnet" + "lfrac", "Sl_landfrac" + "fv", "Sl_fv" + "ram1", "Sl_ram1" + "flddst1", "Fall_flxdst1" + "flxdst2", "Fall_flxdst2" + "flxdst3", "Fall_flxdst3" + "flxdst4", "Fall_flxdst4" + "tsrfNN", "Sl_tsrf" + "topoNN", "Sl_topo" + "qiceNN", "Flgl_qice" + +where NN = (01,02,...,``nflds_snow * glc_nec)``, and ``nflds_snow`` is the number of snow fields in each elevation class and ``glc_nec`` is the number of elevation classes. diff --git a/doc/source/data_models/data-river.rst b/doc/source/data_models/data-river.rst index b6e9c4ca474..626ebdf0704 100644 --- a/doc/source/data_models/data-river.rst +++ b/doc/source/data_models/data-river.rst @@ -13,7 +13,7 @@ This data can either be observational (climatological or interannual river data) xml variables ------------- -The following are xml variables that CIME supports for DROF. +The following are xml variables that CIME supports for DROF. These variables are defined in ``$CIMEROOT/src/components/data_comps/drof/cime_config/config_component.xml``. These variables will appear in ``env_run.xml`` and are used by the DROF ``cime_config/buildnml`` script to generate the DROF namelist file ``drof_in`` and the required associated stream files for the case. @@ -23,13 +23,17 @@ These variables will appear in ``env_run.xml`` and are used by the DROF ``cime_c :header: "xml variable", "description" :widths: 15, 85 - "DROF_MODE", "Data mode" - "", "Valid values are: NULL,CPLHIST,DIATREN_ANN_RX1,DIATREN_IAF_RX1" - "DROF_CPLHIST_CASE", "Coupler history data mode case name" - "DROF_CPLHIST_DIR", "Coupler history data mode directory containing coupler history data" - "DROF_CPLHIST_YR_ALIGN", "Coupler history data model simulation year corresponding to data starting year" - "DROF_CPLHIST_YR_START", "Coupler history data model starting year to loop data over" - "DROF_CPLHIST_YR_END", "Coupler history data model ending year to loop data over" + "DROF_MODE", "Data mode" + "", "Valid values are: NULL,CPLHIST,DIATREN_ANN_RX1,DIATREN_IAF_RX1" + + "DROF_CPLHIST_DOMAIN_FILE", "Coupler history forcing data mode - full pathname of model domain file " + "DROF_CPLHIST_CASE", "Coupler history forcing data mode - case name" + "DROF_CPLHIST_DIR", "Coupler history forcing data mode - directory containing coupler history forcing data" + "DROF_CPLHIST_YR_ALIGN", "Coupler history forcing data mode - simulation year corresponding to DROF_CPLHIST_YR_START" + "DROF_CPLHIST_YR_START", "Coupler history forcing data mode - starting year to loop forcing data over" + "DROF_CPLHIST_YR_END", "Coupler history forcing data mode - ending year to loop forcing data over" + +.. note:: If ``DROF_MODE`` is set to ``CPLHIST``, it is normally assumed that the model domain will be identical to **all** of the stream domains. To ensure this, the xml variables ``ROF_DOMAIN_PATH`` and ``ROF_DOMAIN_FILE`` are ignored and a valid setting **must be given** for ``DROF_CPLHIST_DOMAIN_FILE``. If ``DROF_CPLHIST_DOMAIN_FILE`` is set to ``null``, then the drof component domain information is read in from the first coupler history file in the target stream and it is assumed that the first coupler stream file that is pointed to contains the domain information for that stream. This is the default mode that should be used for this mode. Alternatively, ``DROF_CPLHIST_DOMAIN_FILE`` can be set to ``$ROF_DOMAIN_PATH/$ROF_DOMAIN_FILE`` in a non-default configuration. .. _drof-datamodes: @@ -38,9 +42,9 @@ datamode values -------------------- The xml variable ``DROF_MODE`` sets the streams that are associated with DROF and also sets the namelist variable ``datamode`` that specifies what additional operations need to be done by DROF on the streams before returning to the driver. -One of the variables in ``shr_strdata_nml`` is ``datamode``, whose value is a character string. Each data model has a unique set of ``datamode`` values that it supports. -The valid values for ``datamode`` are set in the file ``namelist_definition_drof.xml`` using the xml variable ``DROF_MODE`` in the ``config_component.xml`` file for DROF. -CIME will generate a value ``datamode`` that is compset dependent. +One of the variables in ``shr_strdata_nml`` is ``datamode``, whose value is a character string. Each data model has a unique set of ``datamode`` values that it supports. +The valid values for ``datamode`` are set in the file ``namelist_definition_drof.xml`` using the xml variable ``DROF_MODE`` in the ``config_component.xml`` file for DROF. +CIME will generate a value ``datamode`` that is compset dependent. The following are the supported DROF datamode values and their relationship to the ``DROF_MODE`` xml variable value. diff --git a/doc/source/data_models/index.rst b/doc/source/data_models/index.rst index 2a305c1afe1..a84dd0748e7 100644 --- a/doc/source/data_models/index.rst +++ b/doc/source/data_models/index.rst @@ -12,8 +12,9 @@ .. toctree:: :maxdepth: 3 :numbered: - + introduction.rst + input-namelists.rst input-streams.rst design-details.rst data-model-science.rst @@ -30,4 +31,3 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` - diff --git a/doc/source/data_models/input-namelists.rst b/doc/source/data_models/input-namelists.rst new file mode 100644 index 00000000000..533f1c1b2f9 --- /dev/null +++ b/doc/source/data_models/input-namelists.rst @@ -0,0 +1,87 @@ +.. _input-namelists: + +Input Namelists +=============== + +Each data model has two namelist groups in its input namelist file: a **stream-dependent** and a **stream-independent** namelist group. + +The stream-dependent namelist group (``shr_strdata_nml``) specifies the data model mode, stream description text files, and interpolation options. +The stream description files will be provided as separate input files and contain the files and fields that need to be read. +The stream-independent namelist group (one of ``[datm_nml, dice_nml, dlnd_nml, docn_nml, drof_nml, dwav_nml]``) contains namelist input such as the data model decomposition, etc. + +For users wanting to introduce new data sources for any data model, it is important to know what modes are supported and the internal field names in the data model. +That information will be used in the ``shr_strdata_nml`` namelist and stream input files. + +Users will primarily set up different data model configurations through namelist settings. +**The stream input options and format are identical for all data models**. +The data model-specific namelist has significant overlap between data models, but each data model has a slightly different set of input namelist variables and each model reads that namelist from a unique filename. +The detailed namelist options for each data model will be described later, but each model will specify a filename or filenames for stream namelist input and each ``shr_strdata_nml`` namelist will specify a set of stream input files. + +The following example illustrates the basic set of namelist inputs:: + + &dlnd_nml + decomp = '1d' + / + &shr_strdata_nml + dataMode = 'CPLHIST' + domainFile = 'grid.nc' + streams = 'streama', 'streamb', 'streamc' + mapalgo = 'interpa', 'interpb', 'interpc' + / + +As mentioned above, the ``dataMode`` namelist variable that is associated with each data model specifies if there are any additional operations that need to be performed on that data model's input streams before return to the driver. +At a minimum, all data models support ``datamode`` values of ``NULL`` and ``COPYALL``. + +- ``NULL`` - turns off the data model as a provider of data to the coupler. + +- ``COPYALL`` - copies all fields directly from the input data streams. Any required fields not found on an input stream will be set to zero. + +Three stream description files (see :ref:`input streams`) are then expected to be available, ``streama``, ``streamb`` and ``streamc``. +Those files specify the input data filenames, input data grids, and input fields that are expected, among other things. +The stream files are **not** Fortran namelist format. +Their format and options will be described later. +As an example, one of the stream description files might look like +:: + + + + GENERIC + + + + dn10 dens + slp_ pslv + q_10 shum + t_10 tbot + u_10 u + v_10 v + + + /glade/proj3/cseg/inputdata/atm/datm7/NYF + + + 0 + + + nyf.ncep.T62.050923.nc + + + + + time time + lon lon + lat lat + area area + mask mask + + + /glade/proj3/cseg/inputdata/atm/datm7/NYF + + + nyf.ncep.T62.050923.nc + + + + + +In general, these examples of input files are not complete, but they do show the general hierarchy and feel of the data model input. diff --git a/doc/source/data_models/input-streams.rst b/doc/source/data_models/input-streams.rst index edb102ff4fb..ea5340fd993 100644 --- a/doc/source/data_models/input-streams.rst +++ b/doc/source/data_models/input-streams.rst @@ -26,16 +26,16 @@ Generally, information about what streams a user wants to use and how to use the -------------------------------------------------- Stream Data and shr_strdata_nml namelists -------------------------------------------------- -The stream data (referred to as *strdata*) input is set via a fortran namelist called ``shr_strdata_nml``. -That namelist, the associated strdata datatype, and the methods are contained in the share source code file, ``shr_strdata_mod.F90``. -In general, strdata input defines an array of input streams and operations to perform on those streams. -Therefore, many namelist inputs are arrays of character strings. +The stream data (referred to as *strdata*) input is set via a fortran namelist called ``shr_strdata_nml``. +That namelist, the associated strdata datatype, and the methods are contained in the share source code file, ``shr_strdata_mod.F90``. +In general, strdata input defines an array of input streams and operations to perform on those streams. +Therefore, many namelist inputs are arrays of character strings. Different variables of the same index are associated. For instance, mapalgo(1) spatial interpolation will be performed between streams(1) and the target domain. -Each data model as an associated input namelist file, ``xxx_in``, where ``xxx=[datm,dlnd,dice,docn,drof,dwav]``. +Each data model as an associated input namelist file, ``xxx_in``, where ``xxx=[datm,dlnd,dice,docn,drof,dwav]``. -The input namelist file for each data model has a stream dependent namelist group, ``shr_strdata_nml``, and a stream independent namelist group. -The ``shr_strdata_nml`` namelist variables **are the same for all data models**. +The input namelist file for each data model has a stream dependent namelist group, ``shr_strdata_nml``, and a stream independent namelist group. +The ``shr_strdata_nml`` namelist variables **are the same for all data models**. =========== ========================================================================================================================== File Namelist Groups @@ -55,7 +55,7 @@ The following table summaries the ``shr_strdata_nml`` entries. =========== ========================================================================================================================== Namelist Description =========== ========================================================================================================================== -dataMode component specific mode. +dataMode component specific mode. Each CIME data model has its own datamode values as described below: @@ -75,27 +75,27 @@ domainFile component domain (all streams will be mapped to this domain). Spatial gridfile associated with the strdata. grid information will be read from this file and that grid will serve as the target grid - for all input data for this strdata input. - If the value is **null** then the domain of the first stream - will be used as the component domain + for all input data for this strdata input. + If the value is **null** then the domain of the first stream + will be used as the component domain - default="null" + default="null" streams character array (up to 30 elemnets) of input stream filenames and associated years of data. - Each array entry 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. - The 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. + Each array entry 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. + The 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. default="null". -fillalgo array (up to 30 elements) of fill algorithms associated with the array of streams. +fillalgo array (up to 30 elements) of fill algorithms associated with the array of streams. - Valid options are just copy (ie. no fill), special value, nearest neighbor, nearest neighbor in "i" direction, - or nearest neighbor in "j" direction. + Valid options are just copy (ie. no fill), special value, nearest neighbor, nearest neighbor in "i" direction, + or nearest neighbor in "j" direction. - valid values: 'copy','spval','nn','nnoni','nnonj' + valid values: 'copy','spval','nn','nnoni','nnonj' default value='nn' @@ -105,7 +105,7 @@ fillmask array (up to 30 elements) of fill masks. default="nomask" -fillread array (up to 30 elements) fill mapping files to read. Secifies the weights file to read in instead of +fillread array (up to 30 elements) fill mapping files to read. Secifies the weights file to read in instead of computing the weights on the fly for the fill operation. If this is set, fillalgo and fillmask are ignored. default='NOT_SET' @@ -126,13 +126,13 @@ mapread array of spatial interpolation mapping files to read (optional) default='NOT_SET' -mapwrite array (up to 30 elements) of spatial interpolation mapping files to write (optional). Specifies the weights file +mapwrite array (up to 30 elements) of spatial interpolation mapping files to write (optional). Specifies the weights file - to generate after weights are computed on the fly for the mapping (interpolation) operation, thereby allowing + to generate after weights are computed on the fly for the mapping (interpolation) operation, thereby allowing users to save and reuse a set of weights later. default='NOT_SET' -tintalgo array (up to 30 elements) of time interpolation algorithm options associated with the array of streams. +tintalgo array (up to 30 elements) of time interpolation algorithm options associated with the array of streams. valid values: lower,upper,nearest,linear,coszen lower = Use lower time-value @@ -149,15 +149,15 @@ tintalgo array (up to 30 elements) of time interpolation algorithm options as taxMode array (up to 30 elements) of time interpolation modes. - Time axis interpolation modes are associated with the array of streams for + Time axis interpolation modes are associated with the array of streams for - handling data outside the specified stream time axis. + handling data outside the specified stream time axis. - Valid options are to cycle the data based on the first, last, and align + 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 + 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 + valid value indefinitely, or to limit the interpolated data to fall only between the least and greatest valid value of the time array. @@ -173,17 +173,17 @@ taxMode array (up to 30 elements) of time interpolation modes. dtlimit array (up to 30 elements) of setting delta time axis limit. - Specifies delta time ratio limits placed on the time interpolation + Specifies delta time ratio limits placed on the time interpolation - associated with the array of streams. Causes the model to stop if + 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 + 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, + 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 delta time should be exactly one day throughout the dataset and - the computed maximum divided by minimum delta time should always be 1.0. + 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 @@ -195,13 +195,13 @@ dtlimit array (up to 30 elements) of setting delta time axis limit. to turn off trapping, set the value to 1.0e30 or something similar. - default=1.5 + default=1.5 vectors paired vector field names =========== ========================================================================================================================== -``shr_strdata_nml`` contains a namelist variable, ``streams``, that specifies a list of input stream description files and for each file what years of data to use, and how to align the input stream time axis with the model run time axis. +``shr_strdata_nml`` contains a namelist variable, ``streams``, that specifies a list of input stream description files and for each file what years of data to use, and how to align the input stream time axis with the model run time axis. The general input format for the ``streams`` namelist variable is: :: @@ -211,7 +211,7 @@ The general input format for the ``streams`` namelist variable is: 'stream2.txt year_align year_first year_last ', ... 'streamN.txt year_align year_first year_last ' - / + / where: :: @@ -225,6 +225,53 @@ where: year_align a model year that will be aligned with data for year_first +--------------------- +Details on year_align +--------------------- + +The ``year_align`` value gives the simulation year corresponding to +``year_first``. A common usage is to set this to the year of +``RUN_STARTDATE``. With this setting, the forcing in the first year of +the run will be the forcing of year ``year_first``. Another use case is +to align the calendar of transient forcing with the model calendar. For +example, setting ``year_align`` = ``year_first`` 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. + +For some data model modes, ``year_align`` 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, we +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, then we 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. -------------------------------------------------- Customizing shr_strdata_nml values @@ -243,48 +290,48 @@ As an example we refer to the following ``datm_in`` contents (that would appear fillmask = 'nomask','nomask','nomask','nomask' mapalgo = 'bilinear','bilinear','bilinear','bilinear' mapmask = 'nomask','nomask','nomask','nomask' - streams = "datm.streams.txt.CLM_QIAN.Solar 1895 1948 1972 ", + streams = "datm.streams.txt.CLM_QIAN.Solar 1895 1948 1972 ", "datm.streams.txt.CLM_QIAN.Precip 1895 1948 1972 ", - "datm.streams.txt.CLM_QIAN.TPQW 1895 1948 1972 ", + "datm.streams.txt.CLM_QIAN.TPQW 1895 1948 1972 ", "datm.streams.txt.presaero.trans_1850-2000 1849 1849 2006" taxmode = 'cycle','cycle','cycle','cycle' tintalgo = 'coszen','nearest','linear','linear' vectors = 'null' / - -As is discussed in the :ref:`CIME User's Guide`, to change the contents of ``datm_in``, you must edit ``$CASEROOT/user_nl_datm``. -In the above example, you can to this to change any of the above settings **except for the names** +As is discussed in the :ref:`CIME User's Guide`, to change the contents of ``datm_in``, you must edit ``$CASEROOT/user_nl_datm``. +In the above example, you can to this to change any of the above settings **except for the names** :: + datm.streams.txt.CLM_QIAN.Solar datm.streams.txt.CLM_QIAN.Precip - datm.streams.txt.CLM_QIAN.TPQW - datm.streams.txt.presaero.trans_1850-2000 + datm.streams.txt.CLM_QIAN.TPQW + datm.streams.txt.presaero.trans_1850-2000 -Other than these names, any namelist variable from ``shr_strdata_nml`` can be modified by adding the appropriate keyword/value pairs to ``user_nl_datm``. +Other than these names, any namelist variable from ``shr_strdata_nml`` can be modified by adding the appropriate keyword/value pairs to ``user_nl_datm``. As an example, the following could be the contents of ``$CASEROOT/user_nl_datm``: :: !------------------------------------------------------------------------ ! Users should ONLY USE user_nl_datm to change namelists variables - ! Users should add all user specific namelist changes below in the form of - ! namelist_var = new_namelist_value - ! Note that any namelist variable from shr_strdata_nml and datm_nml can - ! be modified below using the above syntax + ! Users should add all user specific namelist changes below in the form of + ! namelist_var = new_namelist_value + ! Note that any namelist variable from shr_strdata_nml and datm_nml can + ! be modified below using the above syntax ! User preview_namelists to view (not modify) the output namelist in the ! directory $CASEROOT/CaseDocs ! To modify the contents of a stream txt file, first use preview_namelists ! to obtain the contents of the stream txt files in CaseDocs, and then - ! place a copy of the modified stream txt file in $CASEROOT with the string - ! user_ prepended. + ! place a copy of the modified stream txt file in $CASEROOT with the string + ! user_ prepended. !------------------------------------------------------------------------ - streams = "datm.streams.txt.CLM_QIAN.Solar 1895 1948 1900 ", + streams = "datm.streams.txt.CLM_QIAN.Solar 1895 1948 1900 ", "datm.streams.txt.CLM_QIAN.Precip 1895 1948 1900 ", - "datm.streams.txt.CLM_QIAN.TPQW 1895 1948 1900 ", - "datm.streams.txt.presaero.trans_1850-2000 1849 1849 2006" - + "datm.streams.txt.CLM_QIAN.TPQW 1895 1948 1900 ", + "datm.streams.txt.presaero.trans_1850-2000 1849 1849 2006" + and the contents of ``shr_strdata_nml`` (in both ``$CASEROOT/CaseDocs`` and ``$RUNDIR``) would be :: @@ -295,14 +342,14 @@ and the contents of ``shr_strdata_nml`` (in both ``$CASEROOT/CaseDocs`` and ``$R fillmask = 'nomask','nomask','nomask','nomask' mapalgo = 'bilinear','bilinear','bilinear','bilinear' mapmask = 'nomask','nomask','nomask','nomask' - streams = "datm.streams.txt.CLM_QIAN.Solar 1895 1948 1900 ", + streams = "datm.streams.txt.CLM_QIAN.Solar 1895 1948 1900 ", "datm.streams.txt.CLM_QIAN.Precip 1895 1948 1900 ", - "datm.streams.txt.CLM_QIAN.TPQW 1895 1948 1900 ", + "datm.streams.txt.CLM_QIAN.TPQW 1895 1948 1900 ", "datm.streams.txt.presaero.trans_1850-2000 1849 1849 2006" taxmode = 'cycle','cycle','cycle','cycle' tintalgo = 'coszen','nearest','linear','linear' vectors = 'null' - + As is discussed in the :ref:`CIME User's Guide`, you should use **preview_namelists** to view (not modify) the output namelist in ``CaseDocs``. @@ -312,7 +359,7 @@ As is discussed in the :ref:`CIME User's Guide`, you should use Stream Description File ----------------------- The *stream description file* is not a Fortran namelist, but a locally built xml-like parsing implementation. -Sometimes it is called a "stream dot-text file" because it has a ".txt." in the filename. +Sometimes it is called a "stream dot-text file" because it has a ".txt." in the filename. Stream description files contain data that specifies the names of the fields in the stream, the names of the input data files, and the file system directory where the data files are located. The data elements found in the stream description file are: @@ -348,17 +395,17 @@ The data elements found in the stream description file are: ``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. -The data models advance in time discretely. -At a given time, they read/derive fields from input files. -Those input files have data on a discrete time axis as well. -Each data point in the input files are associated with a discrete time (as opposed to a time interval). +The data models advance in time discretely. +At a given time, they read/derive fields from input files. +Those input files have data on a discrete time axis as well. +Each data point in the input files are associated with a discrete time (as opposed to a time interval). Depending whether you pick lower, upper, nearest, linear, or coszen; the data in the input file will be "interpolated" to the time in the model. -The offset shifts the time axis of the input data the given number of seconds. -So 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. +The offset shifts the time axis of the input data the given number of seconds. +So 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. Actual example: @@ -405,7 +452,7 @@ Actual example: Customizing stream description files -------------------------------------------------- -Each data model's **cime-config/buildnml** utility automatically generates the required stream description files for the case. +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) :: @@ -422,8 +469,7 @@ The ``namelist_definition_datm.xml`` file defines and sets default values for al cp $CASEROOT/CaseDocs/datm.streams.txt.CLM_QIAN.Solar $CASEROOT/user_datm.streams.txt.CLM_QIAN.Solar chmod u+w $CASEROOT/user_datm.streams.txt.CLM_QIAN.Solar -2. - - Edit ``$CASEROOT/user_datm.streams.txt.CLM_QIAN.Solar`` with your desired changes. +2. Edit ``$CASEROOT/user_datm.streams.txt.CLM_QIAN.Solar`` with your desired changes. - *Be sure not to put any tab characters in the file: use spaces instead*. diff --git a/doc/source/data_models/introduction.rst b/doc/source/data_models/introduction.rst index 3ec1846238a..c56b18269e4 100644 --- a/doc/source/data_models/introduction.rst +++ b/doc/source/data_models/introduction.rst @@ -20,28 +20,32 @@ For example, you can perform a fully-coupled run in which you ask for particular In some cases, data models have prognostic functionality, that is, they also receive and use data sent by the driver. However, in most cases, the data models are not running prognostically and have no need to receive any data from the driver. -The CIME data models have parallel capability and share significant amounts of source code. +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 axis. -The information is then passed up to the strdata methods where the data is read and interpolated in space and time. +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 axis. +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 driver. ------ Design ------ -Data models function by reading in different streams of input data and interpolating those data both spatially and temporally to the appropriate final model grid and model time. +Data models function by reading in different streams of input data and interpolating those data both spatially and temporally to the appropriate final model grid and model time. - **Each data model** - communicates with the driver with fields on only the data model model grid. - - can be associated with multiple streams + - can be associated with multiple :ref:`streams` - - is associated with only one datamode value (specified in the ``shr_strdata_nml`` namelist group) + - has an xml variable in ``env_run.xml`` that specifies its 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. + + - has two :ref:`namelist` groups in its input namelist file: a **stream-dependent** and a **stream-independent** namelist group. + + - is associated with only one stream-independent namelist variable ``datamode`` (specified in the ``shr_strdata_nml`` namelist group) that determines if additional operations need to be performed on on the input streams before returning to the driver. - - has an xml variable in ``env_run.xml`` that specifies its mode. These are: - ``DATM_MODE``, ``DICE_MODE``, ``DLND_MODE``, ``DOCN_MODE``, ``DROF_MODE``, ``DWAV_MODE``. - **Each ``DXXX_MODE`` xml variable variable specfies 2 things:** @@ -54,110 +58,23 @@ Data models function by reading in different streams of input data and interpola - ``NULL`` - turns off the data model as a provider of data to the coupler. - ``COPYALL`` - copies all fields directly from the input data streams. Any required fields not found on an input stream will be set to zero. - + + - **Each data model stream** - can be associated with multiple stream input files (specified in the ``shr_strdata_nml`` namelist group). -- **Each stream input file** + +- **Each stream input file** - can contain data on a unique grid and unique temporal time stamps. - is interpolated to a single model grid and the present model time. -More details of the data model design are covered in :ref:`design details`. - --------------- -Namelist Input --------------- - -Each data model has two namelist groups in its input namelist file: a **stream-dependent** and a **stream-independent** namelist group. - -The stream-dependent namelist group (``shr_strdata_nml``) specifies the data model mode, stream description text files, and interpolation options. -The stream description files will be provided as separate input files and contain the files and fields that need to be read. -The stream-independent namelist group (one of ``[datm_nml, dice_nml, dlnd_nml, docn_nml, drof_nml, dwav_nml]``) contains namelist input such as the data model decomposition, etc. - -From a user perspective, for any data model, it is important to know what modes are supported and the internal field names in the data model. -That information will be used in the strdata namelist and stream input files. - -Users will primarily setup different data model configurations through namelist settings. -**The strdata and stream input options and format are identical for all data models**. -The data model specific namelist has significant overlap between data models, but each data model has a slightly different set of input namelist variables and each model reads that namelist from a unique filename. -The detailed namelist options for each data model will be described later, but each model will specify a filename or filenames for strdata namelist input and each strdata namelist will specify a set of stream input files. - -The following example illustrates the basic set of namelist inputs:: - - &dlnd_nml - decomp = '1d' - / - &shr_strdata_nml - dataMode = 'CPLHIST' - domainFile = 'grid.nc' - streams = 'streama', 'streamb', 'streamc' - mapalgo = 'interpa', 'interpb', 'interpc' - / - -As mentioned above, the ``dataMode`` namelist variable that is associated with each data model specifies if there is any additional operations that need to be performed on that data model's input streams before return to the driver. -At a minimum, all data models support ``datamode`` values of ``NULL`` and ``COPYALL``. - -- ``NULL`` - turns off the data model as a provider of data to the coupler. - -- ``COPYALL`` - copies all fields directly from the input data streams. Any required fields not found on an input stream will be set to zero. - -Three stream description files are then expected to be available, ``streama``, ``streamb`` and ``streamc``. -Those files specify the input data filenames, input data grids, and input fields that are expected, among other things. -The stream files are **not** Fortran namelist format. -Their format and options will be described later. -As an example, one of the stream description files might look like -:: - - - - GENERIC - - - - dn10 dens - slp_ pslv - q_10 shum - t_10 tbot - u_10 u - v_10 v - - - /glade/proj3/cseg/inputdata/atm/datm7/NYF - - - 0 - - - nyf.ncep.T62.050923.nc - - - - - time time - lon lon - lat lat - area area - mask mask - - - /glade/proj3/cseg/inputdata/atm/datm7/NYF - - - nyf.ncep.T62.050923.nc - - - - - -In general, these examples of input files are not complete, but they do show the general hierarchy and feel of the data model input. +More details of the data model design are covered in :ref:`design details`. ------------- Next Sections ------------- In the next sections, more details will be presented including a full description of the science modes and namelist settings for the data atmosphere, data land, data runoff, data ocean, and data ice models; namelist settings for the strdata namelist input; a description of the format and options for the stream description input files; and a list of internal field names for each of the data components. The internal data model field names are important because they are used to setup the stream description files and to map the input data fields to the internal data model field names. - - diff --git a/doc/source/users_guide/customizing-a-case.rst b/doc/source/users_guide/customizing-a-case.rst index 7e2d12ab6c2..a36c80e4c04 100644 --- a/doc/source/users_guide/customizing-a-case.rst +++ b/doc/source/users_guide/customizing-a-case.rst @@ -63,21 +63,17 @@ The component processor layout is determined by the following settings: The entries in **env_mach_pes.xml** have the following meanings: - ================== ================================================================================================ - MAX_TASKS_PER_MODE The total number of (MPI tasks) * (OpenMP threads) allowed on a node. - This is defined in **config_machines.xml** and therefore given a default setting, but - can be user modified. - MAX_MPITASKS_PER_NODE The maximum number of MPI tasks per node. - This is defined in **config_machines.xml** and therefore given a default setting, but - can be user modified. - NTASKS Total number of MPI tasks. - A negative value indicates nodes rather than tasks, where - MAX_MPITASKS_PER_NODE * -NTASKS equals the number of MPI tasks. - NTHRDS Number of OpenMP threads per MPI task. - ROOTPE The global MPI task of the component root task; if negative, indicates nodes rather than tasks. - PSTRID The stride of MPI tasks across the global set of pes (for now set to 1). - NINST The number of component instances, which are spread evenly across NTASKS. - ================== ================================================================================================ +.. csv-table:: "Entries in env_mach_pes.xml" + :header: "xml variable", "description" + :widths: 25, 75 + + "MAX_TASKS_PER_MODE", "The total number of (MPI tasks) * (OpenMP threads) allowed on a node. This is defined in **config_machines.xml** and therefore given a default setting, but can be user modified." + "MAX_MPITASKS_PER_NODE", "The maximum number of MPI tasks per node. This is defined in **config_machines.xml** and therefore given a default setting, but can be user modified." + "NTASKS", "Total number of MPI tasks. A negative value indicates nodes rather than tasks, where MAX_MPITASKS_PER_NODE * -NTASKS equals the number of MPI tasks." + "NTHRDS", "Number of OpenMP threads per MPI task." + "ROOTPE", "The global MPI task of the component root task; if negative, indicates nodes rather than tasks." + "PSTRID", "The stride of MPI tasks across the global set of pes (for now set to 1)." + "NINST", "The number of component instances, which are spread evenly across NTASKS." ---------------- **Example 1** diff --git a/src/components/data_comps/datm/cime_config/buildnml b/src/components/data_comps/datm/cime_config/buildnml index a76deb2312b..ae6434e7671 100755 --- a/src/components/data_comps/datm/cime_config/buildnml +++ b/src/components/data_comps/datm/cime_config/buildnml @@ -38,8 +38,6 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): #---------------------------------------------------- # Get a bunch of information from the case. #---------------------------------------------------- - atm_domain_file = case.get_value("ATM_DOMAIN_FILE") - atm_domain_path = case.get_value("ATM_DOMAIN_PATH") datm_mode = case.get_value("DATM_MODE") datm_topo = case.get_value("DATM_TOPO") datm_presaero = case.get_value("DATM_PRESAERO") @@ -62,10 +60,10 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): #---------------------------------------------------- # Log some settings. #---------------------------------------------------- - logger.debug("DATM mode is %s", datm_mode) - logger.debug("DATM grid is %s", atm_grid) - logger.debug("DATM presaero mode is %s", datm_presaero) - logger.debug("DATM topo mode is %s", datm_topo) + logger.debug("DATM mode is {}".format(datm_mode)) + logger.debug("DATM grid is {}".format(atm_grid)) + logger.debug("DATM presaero mode is {}".format(datm_presaero)) + logger.debug("DATM topo mode is {}".format(datm_topo)) #---------------------------------------------------- # Clear out old data. @@ -101,13 +99,13 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): # #pylint: disable=no-member if datm_presaero != "none": - streams.append("presaero.%s" % datm_presaero) + streams.append("presaero.{}".format(datm_presaero)) if datm_topo != "none": - streams.append("topo.%s" % datm_topo) + streams.append("topo.{}".format(datm_topo)) if datm_co2_tseries != "none": - streams.append("co2tseries.%s" % datm_co2_tseries) + streams.append("co2tseries.{}".format(datm_co2_tseries)) # Add bias correction stream if given in namelist. bias_correct = nmlgen.get_value("bias_correct") @@ -128,7 +126,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): continue inst_stream = stream + inst_string - logger.debug("DATM stream is %s", inst_stream) + logger.debug("DATM stream is {}".format(inst_stream)) stream_path = os.path.join(confdir, "datm.streams.txt." + inst_stream) user_stream_path = os.path.join(case.get_case_root(), "user_datm.streams.txt." + inst_stream) @@ -146,16 +144,20 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): # set per-stream variables nmlgen.create_shr_strdata_nml() - # set variables that are not per-stream - if datm_mode == 'CPLHISTForcingForOcnIce': - if atm_domain_file != "UNSET": - if case.get_value('ATM_DOMAIN_FILE') != 'UNSET': - nmlgen.add_default("domainfile", value=atm_domain_file, ignore_abs_path=True) + # Determine model domain filename (in datm_in) + if "CPLHIST" in datm_mode: + datm_cplhist_domain_file = case.get_value("DATM_CPLHIST_DOMAIN_FILE") + if datm_cplhist_domain_file == 'null': + logger.info(" .... Obtaining DATM model domain info from first stream file: {}".format(streams[0])) else: - nmlgen.add_default("domainfile", value='null') + logger.info(" .... Obtaining DATM model domain info from stream {}".format(streams[0])) + nmlgen.add_default("domainfile", value=datm_cplhist_domain_file) else: - full_domain_path = os.path.join(atm_domain_path, atm_domain_file) - nmlgen.add_default("domainfile", value=full_domain_path) + atm_domain_file = case.get_value("ATM_DOMAIN_FILE") + atm_domain_path = case.get_value("ATM_DOMAIN_PATH") + if atm_domain_file != "UNSET": + full_domain_path = os.path.join(atm_domain_path, atm_domain_file) + nmlgen.add_default("domainfile", value=full_domain_path) #---------------------------------------------------- # Finally, write out all the namelists. @@ -185,7 +187,7 @@ def buildnml(case, caseroot, compname): # Determine directory for user modified namelist_definitions.xml and namelist_defaults.xml user_xml_dir = os.path.join(caseroot, "SourceMods", "src." + compname) expect (os.path.isdir(user_xml_dir), - "user_xml_dir %s does not exist " %user_xml_dir) + "user_xml_dir {} does not exist ".format(user_xml_dir)) # NOTE: User definition *replaces* existing definition. files = Files() @@ -195,7 +197,7 @@ def buildnml(case, caseroot, compname): if os.path.isfile(user_definition): definition_file = [user_definition] for file_ in definition_file: - expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) + expect(os.path.isfile(file_), "Namelist XML file {} not found!".format(file_)) # Create the namelist generator object - independent of instance nmlgen = NamelistGenerator(case, definition_file, files=files) @@ -207,7 +209,7 @@ def buildnml(case, caseroot, compname): # determine instance string inst_string = "" if ninst > 1: - inst_string = '_' + '%04d' % inst_counter + inst_string = '_' + '{:04d}'.format(inst_counter) # If multi-instance case does not have restart file, use # single-case restart for each instance @@ -224,7 +226,7 @@ def buildnml(case, caseroot, compname): # create namelist output infile using user_nl_file as input user_nl_file = os.path.join(caseroot, "user_nl_" + compname + inst_string) expect(os.path.isfile(user_nl_file), - "Missing required user_nl_file %s " %(user_nl_file)) + "Missing required user_nl_file {} ".format(user_nl_file)) infile = os.path.join(confdir, "namelist_infile") create_namelist_infile(case, user_nl_file, infile) namelist_infile = [infile] diff --git a/src/components/data_comps/datm/cime_config/config_component.xml b/src/components/data_comps/datm/cime_config/config_component.xml index fb676627e27..a215b529b28 100644 --- a/src/components/data_comps/datm/cime_config/config_component.xml +++ b/src/components/data_comps/datm/cime_config/config_component.xml @@ -17,7 +17,7 @@ CLM CRU NCEP v7 data set GSWP3 data set GSWP3v1 data set - Coupler hist data set + Coupler hist data set (in this mode, it is strongly recommended that the model domain and the coupler history forcing are on the same domain) single point tower site data set COREv2 normal year forcing COREv2 interannual forcing @@ -34,7 +34,7 @@ char - CORE2_NYF,CORE2_IAF,CLM_QIAN,CLM_QIAN_WISO,CLM1PT,CLMCRUNCEP,CLMCRUNCEPv7,CLMGSWP3v1,CPLHISTForcing + CORE2_NYF,CORE2_IAF,CLM_QIAN,CLM_QIAN_WISO,CLM1PT,CLMCRUNCEP,CLMCRUNCEPv7,CLMGSWP3v1,CPLHIST CORE2_NYF run_component_datm env_run.xml @@ -50,7 +50,7 @@ CLMCRUNCEPv7 CLMGSWP3v1 CLM1PT - CPLHISTForcing + CPLHIST @@ -82,12 +82,13 @@ char - none,observed + none,observed,cplhist observed none none + cplhist run_component_datm env_run.xml @@ -111,61 +112,77 @@ DATM CO2 time series + + char + + null + run_component_datm + env_run.xml + + Full pathname for domain file for datm when DATM_MODE is + CPLHIST, NOTE: if this is set to 'null' (the default), then + domain information is read in from the first coupler history + file in the target stream and it is assumed that the first + coupler stream file that is pointed to contains the domain + information for that stream. + + + char UNSET run_component_datm env_run.xml - directory for coupler history data mode (only used for CPLHIST3HrWx mode) + directory for coupler history data mode (only used for when DATM_MODE is CPLHIST) char UNSET - - b40.1850.track1.1deg.006a - run_component_datm env_run.xml - case name for coupler history data mode (only used for CPLHIST3HrWx mode) + case name used to determine stream filenames when DATM_MODE is CPLHIST integer - 1 - - 1 - + -999 run_component_datm env_run.xml - Simulation year corresponding to starting year (only used for CPLHIST3HrWx mode) + + 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 - - 960 - run_component_datm env_run.xml - starting year to loop data over (only used for CPLHIST3HrWx mode) + starting year to loop data over (only used when DATM_MODE is CPLHIST) integer -999 - - 1030 - run_component_datm env_run.xml - ending year to loop data over (only used for CPLHIST3HrWx mode) + ending year to loop data over (only used when DATM_MODE is CPLHIST) diff --git a/src/components/data_comps/datm/cime_config/namelist_definition_datm.xml b/src/components/data_comps/datm/cime_config/namelist_definition_datm.xml index 7e98b5f70a4..7fda117df48 100644 --- a/src/components/data_comps/datm/cime_config/namelist_definition_datm.xml +++ b/src/components/data_comps/datm/cime_config/namelist_definition_datm.xml @@ -39,7 +39,7 @@ CLM1PT = Run with supplied single point data (force CLM) CORE2_NYF = CORE2 normal year forcing (for forcing POP and CICE) CORE2_IAF = CORE2 intra-annual year forcing (for forcing POP and CICE) - CPLHISTForcing = Streams for lnd or ocn/ice forcing used for spinup + CPLHIST = Streams for lnd or ocn/ice forcing used for spinup presaero = Prescribed aerosol forcing topo = Surface topography co2tseries = Time series of prescribed CO2 forcing @@ -108,7 +108,7 @@ Note for CORE2_IAF: The most current versions of forcing files(those recommended for use) are duplicated - below and stored at /ccsm/ocn/iaf/): + below and stored at /ccsm/ocn/iaf/): gcgcs.prec.T62.current, giss.lwdn.T62.current, giss.swdn.T62.current, giss.swup.T62.current, ncep.dn10.T62.current, ncep.q_10.T62.current ncep.slp_.T62.current, ncep.t_10.T62.current, ncep.u_10.T62.current, ncep.v_10.T62.current @@ -135,13 +135,14 @@ presaero.cplhist topo.observed + topo.cplhist **********IMPORTANT NOTE: ************* - In the value matches below, regular expressions are used **** + In the value matches below, regular expressions are used **** If two matches are equivalent, the FIRST one will be used, so need to make sure that matches are not equivalent if possible - As an example, say datm_mode=CLMCRUNCEPv7, + As an example, say datm_mode=CLMCRUNCEPv7, the following order would result in an INCORRECT setting of streams for this datm_mode CLMCRUNCEP.Solar,CLMCRUNCEP.Precip,CLMCRUNCEP.TPQW @@ -171,7 +172,7 @@ 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.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 - CPLHISTForcing.Solar,CPLHISTForcing.nonSolarFlux,CPLHISTForcing.State3hr,CPLHISTForcing.State1hr + CPLHISTForcing.Solar,CPLHISTForcing.nonSolarFlux,CPLHISTForcing.State3hr,CPLHISTForcing.State1hr @@ -222,6 +223,7 @@ $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero $DIN_LOC_ROOT/atm/datm7/topo_forcing + null @@ -294,6 +296,7 @@ aerosoldep_rcp6.0_monthly_1849-2104_1.9x2.5_c100830.nc aerosoldep_rcp8.5_monthly_1849-2104_1.9x2.5_c100201.nc topodata_0.9x1.25_USGS_070110_stream_c151201.nc + null @@ -310,7 +313,7 @@ area area mask mask - + time time doma_lon lon doma_lat lat @@ -386,6 +389,7 @@ $DATM_CPLHIST_DIR $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero $DIN_LOC_ROOT/atm/datm7/topo_forcing + $DATM_CPLHIST_DIR @@ -422,6 +426,7 @@ $DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc $DATM_CPLHIST_CASE.cpl.ha2x1h.%ym.nc $DATM_CPLHIST_CASE.cpl.ha2x1d.%ym.nc + $DATM_CPLHIST_CASE.cpl.ha2x3h.%ym.nc clmforc.Qian.c2006.T62.Solr.%ym.nc clmforc.Qian.c2006.T62.Prec.%ym.nc clmforc.Qian.c2006.T62.TPQW.%ym.nc @@ -1196,7 +1201,7 @@ a2x3h_Sa_z z a2x3h_Sa_tbot tbot - a2x3h_Sa_ptem ptem + a2x3h_Sa_ptem ptem a2x3h_Sa_shum shum a2x3h_Sa_pbot pbot a2x3h_Sa_dens dens @@ -1428,6 +1433,9 @@ DSTX04WD dstwet4 DSTX04DD dstdry4 + + a2x3h_Sa_topo topo + TOPO topo @@ -1460,6 +1468,7 @@ 1849 1849 1 + $DATM_CPLHIST_YR_ALIGN @@ -1511,6 +1520,7 @@ 1849 1849 1 + $DATM_CPLHIST_YR_START @@ -1563,6 +1573,7 @@ 2006 2104 1 + $DATM_CPLHIST_YR_END @@ -1578,6 +1589,7 @@ 900 900 0 + 0 @@ -1593,7 +1605,7 @@ char streams shr_strdata_nml - CLMNCEP,COPYALL,CPLHIST,CORE2_NYF,CORE2_IAF,NULL + CLMNCEP,COPYALL,CORE2_NYF,CORE2_IAF,NULL general method that operates on the data. this is generally implemented in the data models but is set in the strdata method for @@ -1616,8 +1628,6 @@ scientific modes supported by the model, they are listed below. The mode is selected by a character string set in the strdata namelist variable dataMode. - datamode = "CPLHIST" - The same as COPYALL mode. datamode = "CORE2_NYF" Coordinated Ocean-ice Reference Experiments (CORE) Version 2 Normal Year Forcing. datamode = "CORE2_IAF" @@ -1644,7 +1654,7 @@ CLMNCEP CORE2_NYF CORE2_IAF - CPLHIST + COPYALL @@ -1818,6 +1828,7 @@ linear linear nearest + nearest coszen nearest coszen @@ -1913,6 +1924,7 @@ 3.0 3.0 3.0 + 3.0 diff --git a/src/components/data_comps/datm/datm_comp_mod.F90 b/src/components/data_comps/datm/datm_comp_mod.F90 index 4519ae97dc3..d59d1d68ca3 100644 --- a/src/components/data_comps/datm/datm_comp_mod.F90 +++ b/src/components/data_comps/datm/datm_comp_mod.F90 @@ -23,7 +23,7 @@ module datm_comp_mod use seq_timemgr_mod, only: seq_timemgr_EClockGetData, seq_timemgr_RestartAlarmIsOn use datm_shr_mod , only: datm_shr_getNextRadCDay, datm_shr_esat, datm_shr_CORE2getFactors - use datm_shr_mod , only: atm_mode ! namelist input + use datm_shr_mod , only: datamode ! namelist input use datm_shr_mod , only: decomp ! namelist input use datm_shr_mod , only: wiso_datm ! namelist input use datm_shr_mod , only: rest_file ! namelist input @@ -32,7 +32,6 @@ module datm_comp_mod use datm_shr_mod , only: iradsw ! namelist input use datm_shr_mod , only: nullstr - ! ! !PUBLIC TYPES: implicit none @@ -666,9 +665,11 @@ subroutine datm_comp_run(EClock, x2a, a2x, & call t_startf('datm_strdata_advance') call shr_strdata_advance(SDATM,currentYMD,currentTOD,mpicom,'datm') call t_stopf('datm_strdata_advance') + call t_barrierf('datm_scatter_BARRIER',mpicom) + call t_startf('datm_scatter') - if (trim(atm_mode) /= 'COPYALL') then + if (trim(datamode) /= 'COPYALL') then lsize = mct_avect_lsize(a2x) do n = 1,lsize a2x%rAttr(kbid,n) = aerodep_spval @@ -717,13 +718,14 @@ subroutine datm_comp_run(EClock, x2a, a2x, & enddo call t_stopf('datm_scatter') - call t_startf('datm_mode') - select case (trim(atm_mode)) + !------------------------------------------------- + ! Determine data model behavior based on the mode + !------------------------------------------------- - case('COPYALL') - ! do nothing extra + call t_startf('datm_datamode') + select case (trim(datamode)) - case('CPLHIST') + case('COPYALL') ! do nothing extra case('CORE2_NYF','CORE2_IAF') @@ -732,7 +734,7 @@ subroutine datm_comp_run(EClock, x2a, a2x, & write(logunit,F00) 'ERROR: prec and swdn must be in streams for CORE2' call shr_sys_abort(trim(subname)//'ERROR: prec and swdn must be in streams for CORE2') endif - if (trim(atm_mode) == 'CORE2_IAF' ) then + if (trim(datamode) == 'CORE2_IAF' ) then if (starcf < 1 ) then write(logunit,F00) 'ERROR: tarcf must be in an input stream for CORE2_IAF' call shr_sys_abort(trim(subname)//'tarcf must be in an input stream for CORE2_IAF') @@ -776,7 +778,7 @@ subroutine datm_comp_run(EClock, x2a, a2x, & !--- Dupont correction to NCEP Arctic air T --- !--- don't correct during summer months (July-September) !--- ONLY correct when forcing year is 1997->2004 - if (trim(atm_mode) == 'CORE2_IAF' ) then + if (trim(datamode) == 'CORE2_IAF' ) then a2x%rAttr(ktbot,n) = a2x%rAttr(ktbot,n) + avstrm%rAttr(starcf,n) a2x%rAttr(kptem,n) = a2x%rAttr(ktbot,n) end if @@ -979,7 +981,7 @@ subroutine datm_comp_run(EClock, x2a, a2x, & end select - call t_stopf('datm_mode') + call t_stopf('datm_datamode') !---------------------------------------------------------- ! bias correction / anomaly forcing ( start block ) diff --git a/src/components/data_comps/datm/datm_shr_mod.F90 b/src/components/data_comps/datm/datm_shr_mod.F90 index 9ec7e335643..9b6bec422cb 100644 --- a/src/components/data_comps/datm/datm_shr_mod.F90 +++ b/src/components/data_comps/datm/datm_shr_mod.F90 @@ -47,7 +47,7 @@ module datm_shr_mod ! variables obtained from namelist read character(CL) , public :: rest_file ! restart filename character(CL) , public :: rest_file_strm ! restart filename for streams - character(CL) , public :: atm_mode ! mode + character(CL) , public :: datamode ! mode character(len=*), public, parameter :: nullstr = 'undefined' !-------------------------------------------------------------------------- @@ -156,19 +156,18 @@ subroutine datm_shr_read_namelists(mpicom, my_task, master_task, & ! Validate mode - atm_mode = trim(SDATM%dataMode) - if (trim(atm_mode) == 'NULL' .or. & - trim(atm_mode) == 'CORE2_NYF' .or. & - trim(atm_mode) == 'CORE2_IAF' .or. & - trim(atm_mode) == 'CLMNCEP' .or. & - trim(atm_mode) == 'CPLHIST' .or. & - trim(atm_mode) == 'COPYALL' ) then + datamode = trim(SDATM%dataMode) + if (trim(datamode) == 'NULL' .or. & + trim(datamode) == 'CORE2_NYF' .or. & + trim(datamode) == 'CORE2_IAF' .or. & + trim(datamode) == 'CLMNCEP' .or. & + trim(datamode) == 'COPYALL' ) then if (my_task == master_task) then - write(logunit,F00) ' atm mode = ',trim(atm_mode) + write(logunit,F00) ' datm datamode = ',trim(datamode) call shr_sys_flush(logunit) end if else - write(logunit,F00) ' ERROR illegal atm mode = ',trim(atm_mode) + write(logunit,F00) ' ERROR illegal datm datamode = ',trim(datamode) call shr_sys_abort() endif @@ -182,7 +181,7 @@ subroutine datm_shr_read_namelists(mpicom, my_task, master_task, & atm_present = .true. atm_prognostic = .true. endif - if (trim(atm_mode) /= 'NULL') then + if (trim(datamode) /= 'NULL') then atm_present = .true. end if diff --git a/src/components/data_comps/datm/mct/atm_comp_mct.F90 b/src/components/data_comps/datm/mct/atm_comp_mct.F90 index 5a9c1cbbb1a..da051f2530a 100644 --- a/src/components/data_comps/datm/mct/atm_comp_mct.F90 +++ b/src/components/data_comps/datm/mct/atm_comp_mct.F90 @@ -15,7 +15,6 @@ module atm_comp_mct use shr_file_mod , only: shr_file_freeunit use datm_comp_mod , only: datm_comp_init, datm_comp_run, datm_comp_final use datm_shr_mod , only: datm_shr_read_namelists - use datm_shr_mod , only: atm_mode use datm_shr_mod , only: presaero use seq_flds_mod , only: seq_flds_a2x_fields, seq_flds_x2a_fields diff --git a/src/components/data_comps/dice/cime_config/buildnml b/src/components/data_comps/dice/cime_config/buildnml index eef42ff3925..7c054e06a15 100755 --- a/src/components/data_comps/dice/cime_config/buildnml +++ b/src/components/data_comps/dice/cime_config/buildnml @@ -55,8 +55,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): #---------------------------------------------------- # Log some settings. #---------------------------------------------------- - logger.debug("DICE mode is %s", dice_mode) - logger.debug("DICE grid is %s", ice_grid) + logger.debug("DICE mode is {}".format(dice_mode)) + logger.debug("DICE grid is {}".format(ice_grid)) #---------------------------------------------------- # Clear out old data. @@ -95,7 +95,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): continue inst_stream = stream + inst_string - logger.debug("DICE stream is %s", inst_stream) + logger.debug("DICE stream is {}".format(inst_stream)) stream_path = os.path.join(confdir, "dice.streams.txt." + inst_stream) user_stream_path = os.path.join(case.get_case_root(), "user_dice.streams.txt." + inst_stream) @@ -145,7 +145,7 @@ def buildnml(case, caseroot, compname): # determine directory for user modified namelist_definitions.xml and namelist_defaults.xml user_xml_dir = os.path.join(caseroot, "SourceMods", "src." + compname) expect (os.path.isdir(user_xml_dir), - "user_xml_dir %s does not exist " %user_xml_dir) + "user_xml_dir {} does not exist ".format(user_xml_dir)) # NOTE: User definition *replaces* existing definition. files = Files() @@ -155,7 +155,7 @@ def buildnml(case, caseroot, compname): if os.path.isfile(user_definition): definition_file = [user_definition] for file_ in definition_file: - expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) + expect(os.path.isfile(file_), "Namelist XML file {} not found!".format(file_)) # Create the namelist generator object - independent of instance nmlgen = NamelistGenerator(case, definition_file, files=files) @@ -167,7 +167,7 @@ def buildnml(case, caseroot, compname): # determine instance string inst_string = "" if ninst > 1: - inst_string = '_' + '%04d' % inst_counter + inst_string = '_' + "{:04d}".format(inst_counter) # If multi-instance case does not have restart file, use # single-case restart for each instance @@ -184,7 +184,7 @@ def buildnml(case, caseroot, compname): # create namelist output infile using user_nl_file as input user_nl_file = os.path.join(caseroot, "user_nl_" + compname + inst_string) expect(os.path.isfile(user_nl_file), - "Missing required user_nl_file %s " %(user_nl_file)) + "Missing required user_nl_file {} ".format(user_nl_file)) infile = os.path.join(confdir, "namelist_infile") create_namelist_infile(case, user_nl_file, infile) namelist_infile = [infile] diff --git a/src/components/data_comps/dice/dice_comp_mod.F90 b/src/components/data_comps/dice/dice_comp_mod.F90 index 8314c471d82..9310f17db00 100644 --- a/src/components/data_comps/dice/dice_comp_mod.F90 +++ b/src/components/data_comps/dice/dice_comp_mod.F90 @@ -25,7 +25,7 @@ module dice_comp_mod use shr_dmodel_mod , only: shr_dmodel_translate_list, shr_dmodel_translateAV_list, shr_dmodel_translateAV use seq_timemgr_mod , only: seq_timemgr_EClockGetData, seq_timemgr_RestartAlarmIsOn - use dice_shr_mod , only: ice_mode ! namelist input + use dice_shr_mod , only: datamode ! namelist input use dice_shr_mod , only: decomp ! namelist input use dice_shr_mod , only: rest_file ! namelist input use dice_shr_mod , only: rest_file_strm ! namelist input @@ -458,7 +458,7 @@ subroutine dice_comp_run(EClock, x2i, i2x, & !--- copy all fields from streams to i2x as default --- - if (trim(ice_mode) /= 'NULL') then + if (trim(datamode) /= 'NULL') then call t_startf('dice_strdata_advance') call shr_strdata_advance(SDICE,currentYMD,currentTOD,mpicom,'dice') call t_stopf('dice_strdata_advance') @@ -472,9 +472,12 @@ subroutine dice_comp_run(EClock, x2i, i2x, & call mct_aVect_zero(i2x) endif - call t_startf('dice_mode') + !------------------------------------------------- + ! Determine data model behavior based on the mode + !------------------------------------------------- - select case (trim(ice_mode)) + call t_startf('dice_datamode') + select case (trim(datamode)) case('COPYALL') ! do nothing extra @@ -586,18 +589,14 @@ subroutine dice_comp_run(EClock, x2i, i2x, & end do - !---------------------------------------------------------------------------- ! compute atm/ice surface fluxes - !---------------------------------------------------------------------------- call shr_flux_atmIce(iMask ,x2i%rAttr(kz,:) ,x2i%rAttr(kua,:) ,x2i%rAttr(kva,:), & x2i%rAttr(kptem,:) ,x2i%rAttr(kshum,:) ,x2i%rAttr(kdens,:) ,x2i%rAttr(ktbot,:), & i2x%rAttr(kt,:) ,i2x%rAttr(ksen,:) ,i2x%rAttr(klat,:) ,i2x%rAttr(klwup,:), & i2x%rAttr(kevap,:) ,i2x%rAttr(ktauxa,:) ,i2x%rAttr(ktauya,:) ,i2x%rAttr(ktref,:), & i2x%rAttr(kqref,:) ) - !---------------------------------------------------------------------------- ! compute ice/oce surface fluxes (except melth & meltw, see above) - !---------------------------------------------------------------------------- do n=1,lsize if (iMask(n) == 0) then i2x%rAttr(kswpen,n) = spval @@ -623,10 +622,11 @@ subroutine dice_comp_run(EClock, x2i, i2x, & ! iFrac0(n) = i2x%rAttr(kiFrac,n) end do - end select + !------------------------------------------------- ! optional per thickness category fields + !------------------------------------------------- if (seq_flds_i2o_per_cat) then do n=1,lsize @@ -635,7 +635,11 @@ subroutine dice_comp_run(EClock, x2i, i2x, & end do end if - call t_stopf('dice_mode') + call t_stopf('dice_datamode') + + !-------------------- + ! Write restart + !-------------------- if (write_restart) then call t_startf('dice_restart') diff --git a/src/components/data_comps/dice/dice_shr_mod.F90 b/src/components/data_comps/dice/dice_shr_mod.F90 index f1150bb7e01..aabb317b794 100644 --- a/src/components/data_comps/dice/dice_shr_mod.F90 +++ b/src/components/data_comps/dice/dice_shr_mod.F90 @@ -36,7 +36,7 @@ module dice_shr_mod ! variables obtained from namelist read character(CL) , public :: rest_file ! restart filename character(CL) , public :: rest_file_strm ! restart filename for streams - character(CL) , public :: ice_mode ! mode + character(CL) , public :: datamode ! mode character(len=*), public, parameter :: nullstr = 'undefined' !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CONTAINS @@ -139,14 +139,15 @@ subroutine dice_shr_read_namelists(mpicom, my_task, master_task, & ! Validate mode - ice_mode = trim(SDICE%dataMode) - if (trim(ice_mode) == 'NULL' .or. & - trim(ice_mode) == 'SSTDATA' .or. & - trim(ice_mode) == 'COPYALL') then - if (my_task == master_task) & - write(logunit,F00) ' ice mode = ',trim(ice_mode) + datamode = trim(SDICE%dataMode) + if (trim(datamode) == 'NULL' .or. & + trim(datamode) == 'SSTDATA' .or. & + trim(datamode) == 'COPYALL') then + if (my_task == master_task) then + write(logunit,F00) ' dice datamode = ',trim(datamode) + end if else - write(logunit,F00) ' ERROR illegal ice mode = ',trim(ice_mode) + write(logunit,F00) ' ERROR illegal dice datamode = ',trim(datamode) call shr_sys_abort() endif @@ -160,10 +161,10 @@ subroutine dice_shr_read_namelists(mpicom, my_task, master_task, & ice_present = .true. ice_prognostic = .true. endif - if (trim(ice_mode) /= 'NULL') then + if (trim(datamode) /= 'NULL') then ice_present = .true. end if - if (trim(ice_mode) == 'SSTDATA' .or. trim(ice_mode) == 'COPYALL') then + if (trim(datamode) == 'SSTDATA' .or. trim(datamode) == 'COPYALL') then ice_prognostic = .true. endif diff --git a/src/components/data_comps/dlnd/cime_config/buildnml b/src/components/data_comps/dlnd/cime_config/buildnml index 46b0d82ad1a..182b0711133 100755 --- a/src/components/data_comps/dlnd/cime_config/buildnml +++ b/src/components/data_comps/dlnd/cime_config/buildnml @@ -38,11 +38,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): #---------------------------------------------------- # Get a bunch of information from the case. #---------------------------------------------------- - lnd_domain_file = case.get_value("LND_DOMAIN_FILE") - lnd_domain_path = case.get_value("LND_DOMAIN_PATH") dlnd_mode = case.get_value("DLND_MODE") lnd_grid = case.get_value("LND_GRID") - glc_nec = case.get_value("GLC_NEC") #---------------------------------------------------- @@ -56,9 +53,9 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): #---------------------------------------------------- # Log some settings. #---------------------------------------------------- - logger.debug("DLND mode is %s", dlnd_mode) - logger.debug("DLND grid is %s", lnd_grid) - logger.debug("DLND glc_nec is %s", glc_nec) + logger.debug("DLND mode is {}".format(dlnd_mode)) + logger.debug("DLND grid is {}".format(lnd_grid)) + logger.debug("DLND glc_nec is {}".format(glc_nec)) #---------------------------------------------------- # Clear out old data. @@ -84,6 +81,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): # Construct the list of streams. #---------------------------------------------------- streams = nmlgen.get_streams() + #---------------------------------------------------- # For each stream, create stream text file and update # shr_strdata_nml group and input data list. @@ -94,7 +92,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): continue inst_stream = stream + inst_string - logger.debug("DLND stream is %s", inst_stream) + logger.debug("DLND stream is {}".format(inst_stream)) stream_path = os.path.join(confdir, "dlnd.streams.txt." + inst_stream) user_stream_path = os.path.join(case.get_case_root(), "user_dlnd.streams.txt." + inst_stream) @@ -113,10 +111,20 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): # set per-stream variables nmlgen.create_shr_strdata_nml() - # set variables that are not per-stream - if lnd_domain_file != "UNSET": - full_domain_path = os.path.join(lnd_domain_path, lnd_domain_file) - nmlgen.add_default("domainfile", value=full_domain_path) + # Determine model domain filename (in dlnd_in) + if "CPLHIST" in dlnd_mode: + dlnd_cplhist_domain_file = case.get_value("DLND_CPLHIST_DOMAIN_FILE") + if dlnd_cplhist_domain_file == 'null': + logger.info(" .... Obtaining DLND model domain info from first stream file: {}".format(streams[0])) + else: + logger.info(" .... Obtaining DLND model domain info from stream {}".format(streams[0])) + nmlgen.add_default("domainfile", value=dlnd_cplhist_domain_file) + else: + lnd_domain_file = case.get_value("LND_DOMAIN_FILE") + lnd_domain_path = case.get_value("LND_DOMAIN_PATH") + if lnd_domain_file != "UNSET": + full_domain_path = os.path.join(lnd_domain_path, lnd_domain_file) + nmlgen.add_default("domainfile", value=full_domain_path) #---------------------------------------------------- # Finally, write out all the namelists. @@ -146,7 +154,7 @@ def buildnml(case, caseroot, compname): # determine directory for user modified namelist_definitions.xml user_xml_dir = os.path.join(caseroot, "SourceMods", "src." + compname) expect (os.path.isdir(user_xml_dir), - "user_xml_dir %s does not exist " %user_xml_dir) + "user_xml_dir {} does not exist ".format(user_xml_dir)) # NOTE: User definition *replaces* existing definition. files = Files() @@ -156,7 +164,7 @@ def buildnml(case, caseroot, compname): if os.path.isfile(user_definition): definition_file = [user_definition] for file_ in definition_file: - expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) + expect(os.path.isfile(file_), "Namelist XML file {} not found!".format(file_)) # Create the namelist generator object - independent of instance nmlgen = NamelistGenerator(case, definition_file, files=files) @@ -167,7 +175,7 @@ def buildnml(case, caseroot, compname): # determine instance string inst_string = "" if ninst > 1: - inst_string = '_' + '%04d' % inst_counter + inst_string = '_' + "{:04d}".format(inst_counter) # If multi-instance case does not have restart file, use # single-case restart for each instance @@ -184,7 +192,7 @@ def buildnml(case, caseroot, compname): # create namelist output infile using user_nl_file as input user_nl_file = os.path.join(caseroot, "user_nl_" + compname + inst_string) expect(os.path.isfile(user_nl_file), - "Missing required user_nl_file %s " %(user_nl_file)) + "Missing required user_nl_file {} ".format(user_nl_file)) infile = os.path.join(confdir, "namelist_infile") create_namelist_infile(case, user_nl_file, infile) namelist_infile = [infile] diff --git a/src/components/data_comps/dlnd/cime_config/config_component.xml b/src/components/data_comps/dlnd/cime_config/config_component.xml index 7ef837a0886..26e13593e44 100644 --- a/src/components/data_comps/dlnd/cime_config/config_component.xml +++ b/src/components/data_comps/dlnd/cime_config/config_component.xml @@ -44,6 +44,25 @@ set to zero and not utilized. The default is NULL. + + char + + null + + $LND_DOMAIN_PATH/$LND_DOMAIN_FILE + + run_component_dlnd + env_run.xml + + Full pathname for domain file for dlnd when DLND_MODE is CPLHIST + or GLC_CPLHIST. NOTE: if this is set to 'null' (the default), + then domain information is read in from the first coupler + history file in the target stream and it is assumed that the + first coupler stream file that is pointed to contains the domain + information for that stream. + + + char UNSET @@ -76,7 +95,7 @@ integer - 1 + -999 1 1 @@ -86,12 +105,24 @@ run_component_dlnd env_run.xml - year align (only used for CPLHIST mode) + + Simulation year corresponding to DLND_CPLHIST_YR_START (only used + when DLND_MODE is CPLHIST or GLC_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 + DLND_CPLHIST_YR_START. Another use case is to align the calendar + of transient forcing with the model calendar. For example, setting + DLND_CPLHIST_YR_ALIGN=DLND_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 - 1 + -999 1976 26 @@ -101,12 +132,12 @@ run_component_dlnd env_run.xml - starting year to loop data over (only used for CPLHIST mode) + starting year to loop data over (only used when DLND_MODE is CPLHIST or GLC_CPLHIST) integer - 1 + -999 2005 100 @@ -116,7 +147,7 @@ run_component_dlnd env_run.xml - ending year to loop data over (only used for CPLHIST mode) + ending year to loop data over (only used when DLND_MODE is CPLHIST or GLC_CPLHIST) diff --git a/src/components/data_comps/dlnd/cime_config/namelist_definition_dlnd.xml b/src/components/data_comps/dlnd/cime_config/namelist_definition_dlnd.xml index 03a9d31e844..5d008e0dfb0 100644 --- a/src/components/data_comps/dlnd/cime_config/namelist_definition_dlnd.xml +++ b/src/components/data_comps/dlnd/cime_config/namelist_definition_dlnd.xml @@ -43,7 +43,7 @@ lnd.cplhist sno.cplhist - **** NOTE: in the value matches below, regular expressions are used **** + **** NOTE: in the value matches below, regular expressions are used **** If two matches are equivalent, the FIRST one will be used As an example, say dlnd_mode=GLC_CPLHIST @@ -51,7 +51,7 @@ the following will results in the CORRECT set of streams for this dlnd_mode COPYALL COPYALL - + the following order would result in an INCORRECT setting of streams for this datm_mode COPYALL COPYALL @@ -205,10 +205,7 @@ dataMode = "COPYALL" 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 - DLND_MODE - default value: NULL + Set by the DLND_MODE xml variable in env_run.xml NULL diff --git a/src/components/data_comps/dlnd/dlnd_comp_mod.F90 b/src/components/data_comps/dlnd/dlnd_comp_mod.F90 index 9874b0337c0..83b2d014588 100644 --- a/src/components/data_comps/dlnd/dlnd_comp_mod.F90 +++ b/src/components/data_comps/dlnd/dlnd_comp_mod.F90 @@ -22,7 +22,7 @@ module dlnd_comp_mod use seq_timemgr_mod , only: seq_timemgr_EClockGetData, seq_timemgr_RestartAlarmIsOn use glc_elevclass_mod , only: glc_get_num_elevation_classes, glc_elevclass_as_string - use dlnd_shr_mod , only: lnd_mode ! namelist input + use dlnd_shr_mod , only: datamode ! namelist input use dlnd_shr_mod , only: decomp ! namelist input use dlnd_shr_mod , only: rest_file ! namelist input use dlnd_shr_mod , only: rest_file_strm ! namelist input @@ -211,12 +211,12 @@ subroutine dlnd_comp_init(Eclock, x2l, l2x, & call shr_sys_flush(logunit) ! create a data model global seqmap (gsmap) given the data model global grid sizes - ! NOTE: gsmap is initialized using the decomp read in from the docn_in namelist + ! NOTE: gsmap is initialized using the decomp read in from the dlnd_in namelist ! (which by default is "1d") call shr_dmodel_gsmapcreate(gsmap,SDLND%nxg*SDLND%nyg,compid,mpicom,decomp) lsize = mct_gsmap_lsize(gsmap,mpicom) - ! create a rearranger from the data model SDOCN%gsmap to gsmap + ! create a rearranger from the data model DLND%gsmap to gsmap call mct_rearr_init(SDLND%gsmap, gsmap, mpicom, rearr) call t_stopf('dlnd_initgsmaps') @@ -385,6 +385,19 @@ subroutine dlnd_comp_run(EClock, x2l, l2x, & call t_stopf('dlnd') + !------------------------------------------------- + ! Determine data model behavior based on the mode + !------------------------------------------------- + + call t_startf('dlnd_datamode') + select case (trim(datamode)) + + case('COPYALL') + ! do nothing extra + + end select + call t_stopf('dlnd_datamode') + !-------------------- ! Write restart !-------------------- diff --git a/src/components/data_comps/dlnd/dlnd_shr_mod.F90 b/src/components/data_comps/dlnd/dlnd_shr_mod.F90 index 7bd4ba9b896..34714d144bc 100644 --- a/src/components/data_comps/dlnd/dlnd_shr_mod.F90 +++ b/src/components/data_comps/dlnd/dlnd_shr_mod.F90 @@ -32,7 +32,7 @@ module dlnd_shr_mod ! variables obtained from namelist read character(CL) , public :: rest_file ! restart filename character(CL) , public :: rest_file_strm ! restart filename for streams - character(CL) , public :: lnd_mode ! mode + character(CL) , public :: datamode ! mode character(len=*), public, parameter :: nullstr = 'undefined' !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CONTAINS @@ -121,18 +121,18 @@ subroutine dlnd_shr_read_namelists(mpicom, my_task, master_task, & call shr_strdata_readnml(SDLND,trim(filename),mpicom=mpicom) !---------------------------------------------------------------------------- - ! Determine and validate lnd_mode + ! Determine and validate datamode !---------------------------------------------------------------------------- - lnd_mode = trim(SDLND%dataMode) + datamode = trim(SDLND%dataMode) - if (trim(lnd_mode) == 'NULL' .or. & - trim(lnd_mode) == 'COPYALL') then + if (trim(datamode) == 'NULL' .or. & + trim(datamode) == 'COPYALL') then if (my_task == master_task) then - write(logunit,F00) 'lnd mode = ',trim(lnd_mode) + write(logunit,F00) 'dlnd datamode = ',trim(datamode) end if else - write(logunit,F00) ' ERROR illegal lnd mode = ',trim(lnd_mode) + write(logunit,F00) ' ERROR illegal dlnd datamode = ',trim(datamode) call shr_sys_abort() end if @@ -146,7 +146,7 @@ subroutine dlnd_shr_read_namelists(mpicom, my_task, master_task, & lnd_present = .true. lnd_prognostic = .true. endif - if (trim(lnd_mode) /= 'NULL') then + if (trim(datamode) /= 'NULL') then lnd_present = .true. end if diff --git a/src/components/data_comps/docn/cime_config/buildnml b/src/components/data_comps/docn/cime_config/buildnml index 360c84e2db2..edc871c4f2d 100755 --- a/src/components/data_comps/docn/cime_config/buildnml +++ b/src/components/data_comps/docn/cime_config/buildnml @@ -55,8 +55,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): #---------------------------------------------------- # Log some settings. #---------------------------------------------------- - logger.debug("DOCN mode is %s", docn_mode) - logger.debug("DOCN grid is %s", ocn_grid) + logger.debug("DOCN mode is {}".format(docn_mode)) + logger.debug("DOCN grid is {}".format(ocn_grid)) #---------------------------------------------------- # Clear out old data. @@ -95,7 +95,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): continue inst_stream = stream + inst_string - logger.debug("DOCN stream is %s", inst_stream) + logger.debug("DOCN stream is {}".format(inst_stream)) stream_path = os.path.join(confdir, "docn.streams.txt." + inst_stream) user_stream_path = os.path.join(case.get_case_root(), "user_docn.streams.txt." + inst_stream) @@ -154,7 +154,7 @@ def buildnml(case, caseroot, compname): # determine directory for user modified namelist_definitions.xml user_xml_dir = os.path.join(caseroot, "SourceMods", "src." + compname) expect (os.path.isdir(user_xml_dir), - "user_xml_dir %s does not exist " %user_xml_dir) + "user_xml_dir {} does not exist ".format(user_xml_dir)) # NOTE: User definition *replaces* existing definition. files = Files() @@ -164,7 +164,7 @@ def buildnml(case, caseroot, compname): if os.path.isfile(user_definition): definition_file = [user_definition] for file_ in definition_file: - expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) + expect(os.path.isfile(file_), "Namelist XML file {} not found!".format(file_)) # Create the namelist generator object - independent of instance nmlgen = NamelistGenerator(case, definition_file, files=files) @@ -176,7 +176,7 @@ def buildnml(case, caseroot, compname): # determine instance string inst_string = "" if ninst > 1: - inst_string = '_' + '%04d' % inst_counter + inst_string = '_' + "{:04d}".format(inst_counter) # If multi-instance case does not have restart file, use # single-case restart for each instance @@ -193,7 +193,7 @@ def buildnml(case, caseroot, compname): # create namelist output infile using user_nl_file as input user_nl_file = os.path.join(caseroot, "user_nl_" + compname + inst_string) expect(os.path.isfile(user_nl_file), - "Missing required user_nl_file %s " %(user_nl_file)) + "Missing required user_nl_file {} ".format(user_nl_file)) infile = os.path.join(confdir, "namelist_infile") create_namelist_infile(case, user_nl_file, infile) namelist_infile = [infile] diff --git a/src/components/data_comps/docn/cime_config/config_component.xml b/src/components/data_comps/docn/cime_config/config_component.xml index 5c144d23860..e6827b23024 100644 --- a/src/components/data_comps/docn/cime_config/config_component.xml +++ b/src/components/data_comps/docn/cime_config/config_component.xml @@ -131,7 +131,7 @@ run_component_docn env_run.xml Sets aquaplanet forcing filename instead of using an analytic form. - This is only used when DOCN_MODE=sst_aqpfile. + This is only used when DOCN_MODE=sst_aquapfile. diff --git a/src/components/data_comps/docn/docn_comp_mod.F90 b/src/components/data_comps/docn/docn_comp_mod.F90 index 3627f04e8fa..8df7ae0bc9c 100644 --- a/src/components/data_comps/docn/docn_comp_mod.F90 +++ b/src/components/data_comps/docn/docn_comp_mod.F90 @@ -22,8 +22,8 @@ module docn_comp_mod use shr_dmodel_mod , only: shr_dmodel_translate_list, shr_dmodel_translateAV_list, shr_dmodel_translateAV use seq_timemgr_mod , only: seq_timemgr_EClockGetData, seq_timemgr_RestartAlarmIsOn - use docn_shr_mod , only: ocn_mode ! namelist input - use docn_shr_mod , only: aquap_option ! derived from ocn_mode namelist input + use docn_shr_mod , only: datamode ! namelist input + use docn_shr_mod , only: aquap_option ! derived from datamode namelist input use docn_shr_mod , only: decomp ! namelist input use docn_shr_mod , only: rest_file ! namelist input use docn_shr_mod , only: rest_file_strm ! namelist input @@ -94,6 +94,8 @@ module docn_comp_mod !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CONTAINS + !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + !=============================================================================== subroutine docn_comp_init(Eclock, x2o, o2x, & seq_flds_x2o_fields, seq_flds_o2x_fields, & @@ -215,7 +217,7 @@ subroutine docn_comp_init(Eclock, x2o, o2x, & ! Special logic for either prescribed or som aquaplanet - overwrite and ! set mask/frac to 1 - if (ocn_mode == 'SST_AQUAPANAL' .or. ocn_mode == 'SST_AQUAPFILE' .or. ocn_mode == 'SOM_AQUAP') then + if (datamode == 'SST_AQUAPANAL' .or. datamode == 'SST_AQUAPFILE' .or. datamode == 'SOM_AQUAP') then kmask = mct_aVect_indexRA(ggrid%data,'mask') ggrid%data%rattr(kmask,:) = 1 @@ -315,7 +317,7 @@ subroutine docn_comp_init(Eclock, x2o, o2x, & endif endif call shr_mpi_bcast(exists,mpicom,'exists') - if (trim(ocn_mode) == 'SOM' .or. trim(ocn_mode) == 'SOM_AQUAP') then + if (trim(datamode) == 'SOM' .or. trim(datamode) == 'SOM_AQUAP') then if (my_task == master_task) write(logunit,F00) ' reading ',trim(rest_file) call shr_pcdf_readwrite('read',SDOCN%pio_subsystem, SDOCN%io_type, & trim(rest_file), mpicom, gsmap=gsmap, rf1=somtp, rf1n='somtp', io_format=SDOCN%io_format) @@ -438,10 +440,12 @@ subroutine docn_comp_run(EClock, x2o, o2x, & enddo call t_stopf('docn_scatter') - ! --- handle the docn modes + !------------------------------------------------- + ! Determine data model behavior based on the mode + !------------------------------------------------- - call t_startf('docn_mode') - select case (trim(ocn_mode)) + call t_startf('docn_datamode') + select case (trim(datamode)) case('COPYALL') ! do nothing extra @@ -570,7 +574,7 @@ subroutine docn_comp_run(EClock, x2o, o2x, & end select - call t_stopf('docn_mode') + call t_stopf('docn_datamode') !-------------------- ! Write restart @@ -592,7 +596,7 @@ subroutine docn_comp_run(EClock, x2o, o2x, & close(nu) call shr_file_freeUnit(nu) endif - if (trim(ocn_mode) == 'SOM' .or. trim(ocn_mode) == 'SOM_AQUAP') then + if (trim(datamode) == 'SOM' .or. trim(datamode) == 'SOM_AQUAP') then if (my_task == master_task) write(logunit,F04) ' writing ',trim(rest_file),currentYMD,currentTOD call shr_pcdf_readwrite('write', SDOCN%pio_subsystem, SDOCN%io_type,& trim(rest_file), mpicom, gsmap, clobber=.true., rf1=somtp,rf1n='somtp') diff --git a/src/components/data_comps/docn/docn_shr_mod.F90 b/src/components/data_comps/docn/docn_shr_mod.F90 index 1578d5a9a07..7c3d34713c9 100644 --- a/src/components/data_comps/docn/docn_shr_mod.F90 +++ b/src/components/data_comps/docn/docn_shr_mod.F90 @@ -32,7 +32,7 @@ module docn_shr_mod ! variables obtained from namelist read character(CL) , public :: rest_file ! restart filename character(CL) , public :: rest_file_strm ! restart filename for streams - character(CL) , public :: ocn_mode ! mode + character(CL) , public :: datamode ! mode integer(IN) , public :: aquap_option character(len=*), public, parameter :: nullstr = 'undefined' !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -122,37 +122,37 @@ subroutine docn_shr_read_namelists(mpicom, my_task, master_task, & call shr_strdata_readnml(SDOCN,trim(filename),mpicom=mpicom) - ocn_mode = trim(SDOCN%dataMode) + datamode = trim(SDOCN%dataMode) ! Special logic for prescribed aquaplanet - if (ocn_mode(1:9) == 'SST_AQUAP' .and. trim(ocn_mode) /= 'SST_AQUAPFILE') then + if (datamode(1:9) == 'SST_AQUAP' .and. trim(datamode) /= 'SST_AQUAPFILE') then ! First determine the prescribed aquaplanet option - if (len_trim(ocn_mode) == 10) then - read(ocn_mode(10:10),'(i1)') aquap_option - else if (len_trim(ocn_mode) == 11) then - read(ocn_mode(10:11),'(i2)') aquap_option + if (len_trim(datamode) == 10) then + read(datamode(10:10),'(i1)') aquap_option + else if (len_trim(datamode) == 11) then + read(datamode(10:11),'(i2)') aquap_option end if - ! Now remove the index from the ocn_mode value, to have a generic setting + ! Now remove the index from the datamode value, to have a generic setting ! for use below - ocn_mode = "SST_AQUAPANAL" + datamode = "SST_AQUAPANAL" end if ! Validate mode - if (trim(ocn_mode) == 'NULL' .or. & - trim(ocn_mode) == 'SSTDATA' .or. & - trim(ocn_mode) == 'SST_AQUAPANAL' .or. & - trim(ocn_mode) == 'SST_AQUAPFILE' .or. & - trim(ocn_mode) == 'COPYALL' .or. & - trim(ocn_mode) == 'IAF' .or. & - trim(ocn_mode) == 'SOM' .or. & - trim(ocn_mode) == 'SOM_AQUAP') then + if (trim(datamode) == 'NULL' .or. & + trim(datamode) == 'SSTDATA' .or. & + trim(datamode) == 'SST_AQUAPANAL' .or. & + trim(datamode) == 'SST_AQUAPFILE' .or. & + trim(datamode) == 'COPYALL' .or. & + trim(datamode) == 'IAF' .or. & + trim(datamode) == 'SOM' .or. & + trim(datamode) == 'SOM_AQUAP') then if (my_task == master_task) then - write(logunit,F00) ' ocn mode = ',trim(ocn_mode) + write(logunit,F00) ' docn datamode = ',trim(datamode) end if else - write(logunit,F00) ' ERROR illegal ocn mode = ',trim(ocn_mode) + write(logunit,F00) ' ERROR illegal docn datamode = ',trim(datamode) call shr_sys_abort() endif @@ -168,14 +168,14 @@ subroutine docn_shr_read_namelists(mpicom, my_task, master_task, & ocn_prognostic = .true. ocnrof_prognostic = .true. endif - if (trim(ocn_mode) /= 'NULL') then + if (trim(datamode) /= 'NULL') then ocn_present = .true. end if - if (trim(ocn_mode) == 'IAF') then + if (trim(datamode) == 'IAF') then ocn_prognostic = .true. ocnrof_prognostic = .true. endif - if (trim(ocn_mode) == 'SOM' .or. trim(ocn_mode) == 'SOM_AQUAP') then + if (trim(datamode) == 'SOM' .or. trim(datamode) == 'SOM_AQUAP') then ocn_prognostic = .true. endif diff --git a/src/components/data_comps/drof/cime_config/buildnml b/src/components/data_comps/drof/cime_config/buildnml index 37b0a3a7a3f..2b4ece2ced3 100755 --- a/src/components/data_comps/drof/cime_config/buildnml +++ b/src/components/data_comps/drof/cime_config/buildnml @@ -54,8 +54,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): #---------------------------------------------------- # Log some settings. #---------------------------------------------------- - logger.debug("DROF mode is %s", drof_mode) - logger.debug("DROF grid is %s", rof_grid) + logger.debug("DROF mode is {}".format(drof_mode)) + logger.debug("DROF grid is {}".format(rof_grid)) #---------------------------------------------------- # Clear out old data. @@ -93,7 +93,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): continue inst_stream = stream + inst_string - logger.debug("DROF stream is %s", inst_stream) + logger.debug("DROF stream is {}".format(inst_stream)) stream_path = os.path.join(confdir, "drof.streams.txt." + inst_stream) user_stream_path = os.path.join(case.get_case_root(), "user_drof.streams.txt." + inst_stream) @@ -112,6 +112,21 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): # set per-stream variables nmlgen.create_shr_strdata_nml() + # Determine model domain filename (in drof_in) + if "CPLHIST" in drof_mode: + drof_cplhist_domain_file = case.get_value("DROF_CPLHIST_DOMAIN_FILE") + if drof_cplhist_domain_file == 'null': + logger.info(" .... Obtaining DROF model domain info from first stream file: {}".format(streams[0])) + else: + logger.info(" .... Obtaining DROF model domain info from stream {}".format(streams[0])) + nmlgen.add_default("domainfile", value=drof_cplhist_domain_file) + else: + rof_domain_file = case.get_value("ROF_DOMAIN_FILE") + rof_domain_path = case.get_value("ROF_DOMAIN_PATH") + if rof_domain_file != "UNSET": + full_domain_path = os.path.join(rof_domain_path, rof_domain_file) + nmlgen.add_default("domainfile", value=full_domain_path) + # set variables that are not per-stream if rof_domain_file != "UNSET": full_domain_path = os.path.join(rof_domain_path, rof_domain_file) @@ -145,7 +160,7 @@ def buildnml(case, caseroot, compname): # determine directory for user modified namelist_definitions.xml user_xml_dir = os.path.join(caseroot, "SourceMods", "src." + compname) expect (os.path.isdir(user_xml_dir), - "user_xml_dir %s does not exist " %user_xml_dir) + "user_xml_dir {} does not exist ".format(user_xml_dir)) # NOTE: User definition *replaces* existing definition. files = Files() @@ -155,7 +170,7 @@ def buildnml(case, caseroot, compname): if os.path.isfile(user_definition): definition_file = [user_definition] for file_ in definition_file: - expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) + expect(os.path.isfile(file_), "Namelist XML file {} not found!".format(file_)) # Create the namelist generator object - independent of instance nmlgen = NamelistGenerator(case, definition_file) @@ -167,7 +182,7 @@ def buildnml(case, caseroot, compname): # determine instance string inst_string = "" if ninst > 1: - inst_string = '_' + '%04d' % inst_counter + inst_string = '_' + "{:04d}".format(inst_counter) # If multi-instance case does not have restart file, use # single-case restart for each instance @@ -184,7 +199,7 @@ def buildnml(case, caseroot, compname): # create namelist output infile using user_nl_file as input user_nl_file = os.path.join(caseroot, "user_nl_" + compname + inst_string) expect(os.path.isfile(user_nl_file), - "Missing required user_nl_file %s " %(user_nl_file)) + "Missing required user_nl_file {} ".format(user_nl_file)) infile = os.path.join(confdir, "namelist_infile") create_namelist_infile(case, user_nl_file, infile) namelist_infile = [infile] diff --git a/src/components/data_comps/drof/cime_config/config_component.xml b/src/components/data_comps/drof/cime_config/config_component.xml index dc2b86b0eea..54e23c9d2ef 100644 --- a/src/components/data_comps/drof/cime_config/config_component.xml +++ b/src/components/data_comps/drof/cime_config/config_component.xml @@ -52,13 +52,29 @@ default is DIATREN_ANN_RX1. + + char + + null + run_component_drof + env_run.xml + + Full pathname for domain file for drof when DROF_MODE is + CPLHIST. NOTE: if this is set to 'null' (the default), then + domain information is read in from the first coupler history + file in the target stream and it is assumed that the first + coupler stream file that is pointed to contains the domain + information for that stream. + + + char UNSET run_component_drof env_run.xml - directory for coupler history data mode (only used for CPLHIST mode) + directory for coupler history data mode (only used when DROF_MODE is CPLHIST mode) @@ -67,34 +83,46 @@ UNSET run_component_drof env_run.xml - case name for coupler history data mode (only used for CPLHIST mode) + case name for coupler history data mode (only used when DROF_MODE is CPLHIST mode) integer - 1 + -999 run_component_drof env_run.xml - year align (only used for CPLHIST mode) + + Simulation year corresponding to DROF_CPLHIST_YR_START (only used + when DROF_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 DROF_CPLHIST_YR_START. Another + use case is to align the calendar of transient forcing with the + model calendar. For example, setting + DROF_CPLHIST_YR_ALIGN=DROF_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 - 1 + -999 run_component_drof env_run.xml - starting year to loop data over (only used for CPLHIST mode) + starting year to loop data over (only used when DROF_MODE is CPLHIST) integer - 1 + -999 run_component_drof env_run.xml - ending year to loop data over (only used for CPLHIST mode) + ending year to loop data over (only used when DROF_MODE is CPLHIST) diff --git a/src/components/data_comps/drof/drof_comp_mod.F90 b/src/components/data_comps/drof/drof_comp_mod.F90 index 6a984a58ff3..7152af4a6e4 100644 --- a/src/components/data_comps/drof/drof_comp_mod.F90 +++ b/src/components/data_comps/drof/drof_comp_mod.F90 @@ -19,7 +19,7 @@ module drof_comp_mod use shr_dmodel_mod , only: shr_dmodel_translate_list, shr_dmodel_translateAV_list, shr_dmodel_translateAV use seq_timemgr_mod , only: seq_timemgr_EClockGetData, seq_timemgr_RestartAlarmIsOn - use drof_shr_mod , only: rof_mode ! namelist input + use drof_shr_mod , only: datamode ! namelist input use drof_shr_mod , only: decomp ! namelist input use drof_shr_mod , only: rest_file ! namelist input use drof_shr_mod , only: rest_file_strm ! namelist input @@ -180,6 +180,19 @@ subroutine drof_comp_init(Eclock, x2r, r2x, & call mct_aVect_zero(r2x) call t_stopf('drof_initmctavs') + !------------------------------------------------- + ! Determine data model behavior based on the mode + !------------------------------------------------- + + call t_startf('drof_datamode') + select case (trim(datamode)) + + case('COPYALL') + ! do nothing extra + + end select + call t_stopf('dlnd_datamode') + !---------------------------------------------------------------------------- ! Read restart !---------------------------------------------------------------------------- @@ -330,6 +343,19 @@ subroutine drof_comp_run(EClock, x2r, r2x, & call t_stopf('drof_r') + !------------------------------------------------- + ! Determine data model behavior based on the mode + !------------------------------------------------- + + call t_startf('drof_datamode') + select case (trim(datamode)) + + case('COPYALL') + ! do nothing extra + + end select + call t_stopf('drof_datamode') + !-------------------- ! Write restart !-------------------- diff --git a/src/components/data_comps/drof/drof_shr_mod.F90 b/src/components/data_comps/drof/drof_shr_mod.F90 index f574cbadde9..b519984e6bd 100644 --- a/src/components/data_comps/drof/drof_shr_mod.F90 +++ b/src/components/data_comps/drof/drof_shr_mod.F90 @@ -32,7 +32,7 @@ module drof_shr_mod ! variables obtained from namelist read character(CL) , public :: rest_file ! restart filename character(CL) , public :: rest_file_strm ! restart filename for streams - character(CL) , public :: rof_mode ! mode + character(CL) , public :: datamode ! mode character(len=*), public, parameter :: nullstr = 'undefined' !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CONTAINS @@ -122,17 +122,17 @@ subroutine drof_shr_read_namelists(mpicom, my_task, master_task, & call shr_strdata_readnml(SDROF,trim(filename),mpicom=mpicom) - rof_mode = trim(SDROF%dataMode) + datamode = trim(SDROF%dataMode) ! Validate mode - if (trim(rof_mode) == 'NULL' .or. & - trim(rof_mode) == 'COPYALL') then + if (trim(datamode) == 'NULL' .or. & + trim(datamode) == 'COPYALL') then if (my_task == master_task) then - write(logunit,F00) 'rof mode = ',trim(rof_mode) + write(logunit,F00) 'drof datamode = ',trim(datamode) end if else - write(logunit,F00) ' ERROR illegal rof mode = ',trim(rof_mode) + write(logunit,F00) ' ERROR illegal drof datamode = ',trim(datamode) call shr_sys_abort() end if @@ -148,7 +148,7 @@ subroutine drof_shr_read_namelists(mpicom, my_task, master_task, & rof_present = .true. rof_prognostic = .true. endif - if (trim(rof_mode) /= 'NULL') then + if (trim(datamode) /= 'NULL') then rof_present = .true. rofice_present = .true. end if diff --git a/src/components/data_comps/dwav/cime_config/buildnml b/src/components/data_comps/dwav/cime_config/buildnml index 3aeffe5afbb..53f40c816d7 100755 --- a/src/components/data_comps/dwav/cime_config/buildnml +++ b/src/components/data_comps/dwav/cime_config/buildnml @@ -53,8 +53,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): #---------------------------------------------------- # Log some settings. #---------------------------------------------------- - logger.debug("DWAV mode is %s", dwav_mode) - logger.debug("DWAV grid is %s", wav_grid) + logger.debug("DWAV mode is {}".format(dwav_mode)) + logger.debug("DWAV grid is {}".format(wav_grid)) #---------------------------------------------------- # Clear out old data. @@ -91,7 +91,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen): continue inst_stream = stream + inst_string - logger.debug("DWAV stream is %s", inst_stream) + logger.debug("DWAV stream is {}".format(inst_stream)) stream_path = os.path.join(confdir, "dwav.streams.txt." + inst_stream) user_stream_path = os.path.join(case.get_case_root(), "user_dwav.streams.txt." + inst_stream) @@ -144,7 +144,7 @@ def buildnml(case, caseroot, compname): # determine directory for user modified namelist_definitions.xml user_xml_dir = os.path.join(caseroot, "SourceMods", "src." + compname) expect (os.path.isdir(user_xml_dir), - "user_xml_dir %s does not exist " %user_xml_dir) + "user_xml_dir {} does not exist ".format(user_xml_dir)) # NOTE: User definition *replaces* existing definition. files = Files() @@ -154,7 +154,7 @@ def buildnml(case, caseroot, compname): if os.path.isfile(user_definition): definition_file = [user_definition] for file_ in definition_file: - expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) + expect(os.path.isfile(file_), "Namelist XML file {} not found!".format(file_)) # Create the namelist generator object - independent of instance nmlgen = NamelistGenerator(case, definition_file) @@ -166,7 +166,7 @@ def buildnml(case, caseroot, compname): # determine instance string inst_string = "" if ninst > 1: - inst_string = '_' + '%04d' % inst_counter + inst_string = '_' + "{:04d}".format(inst_counter) # If multi-instance case does not have restart file, use # single-case restart for each instance @@ -183,7 +183,7 @@ def buildnml(case, caseroot, compname): # create namelist output infile using user_nl_file as input user_nl_file = os.path.join(caseroot, "user_nl_" + compname + inst_string) expect(os.path.isfile(user_nl_file), - "Missing required user_nl_file %s " %(user_nl_file)) + "Missing required user_nl_file {} ".format(user_nl_file)) infile = os.path.join(confdir, "namelist_infile") create_namelist_infile(case, user_nl_file, infile) namelist_infile = [infile] diff --git a/src/components/data_comps/dwav/cime_config/namelist_definition_dwav.xml b/src/components/data_comps/dwav/cime_config/namelist_definition_dwav.xml index 745ebb789f8..6dc458ad941 100644 --- a/src/components/data_comps/dwav/cime_config/namelist_definition_dwav.xml +++ b/src/components/data_comps/dwav/cime_config/namelist_definition_dwav.xml @@ -1,3 +1,4 @@ + @@ -176,22 +177,22 @@ char streams shr_strdata_nml - null,copyall + NULL,COPYALL The wave data is associated with the wave model and is normally on a different grid than the ocean data. - datamode = "null" - null is always a valid option and means no data will be generated. + datamode = "NULL" + Is always a valid option and means no data will be generated. Turns off the data model as a provider of data to the coupler. - datamode = "copyall" + datamode = "COPYALL" 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 - copyall - null + COPYALL + NULL diff --git a/src/components/data_comps/dwav/dwav_comp_mod.F90 b/src/components/data_comps/dwav/dwav_comp_mod.F90 index 2006f1ada40..5999cae4ffc 100644 --- a/src/components/data_comps/dwav/dwav_comp_mod.F90 +++ b/src/components/data_comps/dwav/dwav_comp_mod.F90 @@ -4,7 +4,7 @@ module dwav_comp_mod ! !USES: - + use esmf use mct_mod use perf_mod @@ -20,7 +20,7 @@ module dwav_comp_mod use shr_dmodel_mod , only: shr_dmodel_translate_list, shr_dmodel_translateAV_list, shr_dmodel_translateAV use seq_timemgr_mod , only: seq_timemgr_EClockGetData, seq_timemgr_RestartAlarmIsOn - use dwav_shr_mod , only: wav_mode ! namelist input + use dwav_shr_mod , only: datamode ! namelist input use dwav_shr_mod , only: decomp ! namelist input use dwav_shr_mod , only: rest_file ! namelist input use dwav_shr_mod , only: rest_file_strm ! namelist input @@ -71,7 +71,7 @@ subroutine dwav_comp_init(Eclock, x2w, w2x, & ! !INPUT/OUTPUT PARAMETERS: type(ESMF_Clock) , intent(in) :: EClock type(mct_aVect) , intent(inout) :: x2w, w2x ! input/output attribute vectors - type(shr_strdata_type) , intent(inout) :: SDWAV ! model + type(shr_strdata_type) , intent(inout) :: SDWAV ! model type(mct_gsMap) , pointer :: gsMap ! model global seg map (output) type(mct_gGrid) , pointer :: ggrid ! model ggrid (output) integer(IN) , intent(in) :: mpicom ! mpi communicator @@ -146,12 +146,12 @@ subroutine dwav_comp_init(Eclock, x2w, w2x, & call shr_sys_flush(logunit) ! create a data model global seqmap (gsmap) given the data model global grid sizes - ! NOTE: gsmap is initialized using the decomp read in from the docn_in namelist + ! NOTE: gsmap is initialized using the decomp read in from the docn_in namelist ! (which by default is "1d") call shr_dmodel_gsmapcreate(gsmap,SDWAV%nxg*SDWAV%nyg,compid,mpicom,decomp) lsize = mct_gsmap_lsize(gsmap,mpicom) - ! create a rearranger from the data model SDOCN%gsmap to gsmap + ! create a rearranger from the data model SDOCN%gsmap to gsmap call mct_rearr_init(SDWAV%gsmap,gsmap,mpicom,rearr) write(logunit,*)'lsize= ',lsize @@ -261,7 +261,7 @@ subroutine dwav_comp_run(EClock, x2w, w2x, & ! !INPUT/OUTPUT PARAMETERS: type(ESMF_Clock) , intent(in) :: EClock type(mct_aVect) , intent(inout) :: x2w - type(mct_aVect) , intent(inout) :: w2x + type(mct_aVect) , intent(inout) :: w2x type(shr_strdata_type) , intent(inout) :: SDWAV type(mct_gsMap) , pointer :: gsMap type(mct_gGrid) , pointer :: ggrid @@ -326,8 +326,19 @@ subroutine dwav_comp_run(EClock, x2w, w2x, & enddo call t_stopf('dwav_scatter') - call t_startf('dwav_mode') - call t_stopf('dwav_mode') + !------------------------------------------------- + ! Determine data model behavior based on the mode + !------------------------------------------------- + + call t_startf('datamode') + select case (trim(datamode)) + + case('COPYALL') + ! do nothing extra + + end select + + call t_stopf('datamode') !-------------------- ! Write restart @@ -393,9 +404,9 @@ subroutine dwav_comp_final(my_task, master_task, logunit) call t_startf('DWAV_FINAL') if (my_task == master_task) then - write(logunit,F91) + write(logunit,F91) write(logunit,F00) trim(myModelName),': end of main integration loop' - write(logunit,F91) + write(logunit,F91) end if call t_stopf('DWAV_FINAL') diff --git a/src/components/data_comps/dwav/dwav_shr_mod.F90 b/src/components/data_comps/dwav/dwav_shr_mod.F90 index f8dd6265857..8749f9216e5 100644 --- a/src/components/data_comps/dwav/dwav_shr_mod.F90 +++ b/src/components/data_comps/dwav/dwav_shr_mod.F90 @@ -1,13 +1,13 @@ module dwav_shr_mod ! !USES: - - use shr_kind_mod , only : IN=>SHR_KIND_IN, R8=>SHR_KIND_R8 + + use shr_kind_mod , only : IN=>SHR_KIND_IN, R8=>SHR_KIND_R8 use shr_kind_mod , only : CS=>SHR_KIND_CS, CL=>SHR_KIND_CL use shr_file_mod , only : shr_file_getunit, shr_file_freeunit use shr_sys_mod , only : shr_sys_flush, shr_sys_abort use shr_strdata_mod, only : shr_strdata_type, shr_strdata_readnml - use shr_mpi_mod , only : shr_mpi_bcast + use shr_mpi_mod , only : shr_mpi_bcast ! !PUBLIC TYPES: implicit none @@ -32,7 +32,7 @@ module dwav_shr_mod ! variables obtained from namelist read character(CL) , public :: rest_file ! restart filename character(CL) , public :: rest_file_strm ! restart filename for streams - character(CL) , public :: wav_mode ! mode + character(CL) , public :: datamode ! mode character(len=*), public, parameter :: nullstr = 'undefined' !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CONTAINS @@ -121,18 +121,18 @@ subroutine dwav_shr_read_namelists(mpicom, my_task, master_task, & call shr_strdata_readnml(SDWAV,trim(filename),mpicom=mpicom) !---------------------------------------------------------------------------- - ! Determine and validate wav_mode + ! Determine and validate datamode !---------------------------------------------------------------------------- - wav_mode = trim(SDWAV%dataMode) + datamode = trim(SDWAV%dataMode) - if (trim(wav_mode) == 'null' .or. & - trim(wav_mode) == 'copyall') then + if (trim(datamode) == 'NULL' .or. & + trim(datamode) == 'COPYALL') then if (my_task == master_task) then - write(logunit,F00) 'wav mode = ',trim(wav_mode) + write(logunit,F00) 'dwav datamode = ',trim(datamode) end if else - write(logunit,F00) ' ERROR illegal wav mode = ',trim(wav_mode) + write(logunit,F00) ' ERROR illegal dwav datamode = ',trim(datamode) call shr_sys_abort() end if @@ -146,7 +146,7 @@ subroutine dwav_shr_read_namelists(mpicom, my_task, master_task, & wav_present = .true. wav_prognostic = .true. endif - if (trim(wav_mode) /= 'NULL') then + if (trim(datamode) /= 'NULL') then wav_present = .true. end if